跳至內容

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

已提問 1 年前檢視次數 271 次
1 個回答
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)

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。