简体   繁体   中英

Issue with Routing on Angular using AWS Amplify

Hopefully someone can point me in the right direction for this issue I'm experiencing deploying my Angular application to AWS Amplify.

It works and routes correctly on localhost, but not when deployed to AWS.

I've got my build up and running ok on both a master branch and a development branch, all with custom URL/SSL set up. So that is working brilliantly.

My issue is when I try to navigate to a URL on my application, I just get the index.html page being served.

I've read a few different articles here on Stack Overflow with similar issues, but I can't seem to get it to work. I've seen the mention of changing the redirect setting to a 200 redirect to index.html like the suggestions:

</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$)([^.]+$)/>

But that still doesn't serve my pages, and just returns the contents of the index.html page (although the URL itself in the browser is showing the correct one like myurl.com/users/list).

Anyone have any ideas?

如果你收到 404 错误,总是重定向到 index.html 文件,让 Angular 有机会处理路由。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM