Direkt zum Inhalt

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

gefragt vor einem Jahr274 Aufrufe
1 Antwort
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)

beantwortet vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.