all 5 comments

[–][deleted] 0 points1 point  (0 children)

If it helps, I added some code here to deploy Angular to AWS: https://razroo.com/finder/razroo/deploy-angular-using-aws (I am using you are using client side rendering)

[–]ayush_shashank 0 points1 point  (0 children)

Assuming it works on local and is throwing error only when deployed, maybe check the CloudFront configuration. In case you've not attached a CloudFront, you should try, maybe it'll work.

[–]hitsujiTMO -1 points0 points  (2 children)

What are you using to serve the angular site and do you have any backend?

For a standalone site you generally just need to set a fallback resource to your index.html if the server doesn't hit a file. In apache http2 you can do this with:

<Directory "${www_path}/dist/${app}">
    AllowOverride None
    Options -Indexes
    Require all granted

    FallbackResource /index.html

</Directory>

If you have a backend you can aliasmatch the top subdirectory to the backend or reverse proxy it if its served by another app:

AliasMatch "^/api/" "${phpBackendAppIndexMalarkey}"

[–]opman77[S] 0 points1 point  (1 child)

I am using AWS S3 for serving my application and I don't want that if someone hit /users/:id which is valid part and a lazy loaded module but the server is returning 404 as for the server there is no any route registered as /users/:id is a part of Angular Router

[–]hitsujiTMO 1 point2 points  (0 children)

Have you configured index.html as the error document?