Ir para o conteúdo

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

feita há um ano274 visualizações
1 Resposta
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)

respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.