Skip to content

Amplify rewrite problem

0

I have an Amplify React app that was working fine about a week ago but now it is redirecting everything to index.html; all js, css, images, favicon.ico, everything! I've scoured the web for a solution and I've tried all sorts of redirect and rewrite combinations including the recommended rule for a SPA: </^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json|webp)$)([^.]+$)/>, /index.html, 404 (Rewrite)

I'm actually not sure it's even running the rules. I add one like this: <*.js>, /nowhere.html, 302 (Redirect - Temporary) and it still returns the index.html for js files. What am I missing?

I'm pretty sure it's not my React code because I have an older version of it deployed that I haven't touched in two weeks that worked fine then and is now exhibiting this same weird rewrite behavior.

The site URL is: https://research.d18so0j5q034.amplifyapp.com/

js file giving html

asked a year ago268 views
1 Answer
0

I think that your rule </^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json|webp)$)([^.]+$)/>, /index.html, 404 (Rewrite)

Should be

</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json|webp)$)([^.]+$)/>, /index.html, 200 (Rewrite)

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.