LF-3921d Fix nginx 'rewrite or internal redirection cycle while internally redirecting to "/index.html"' error #3030
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to two Previous PRs:
After the most recent PR, Nginx began crashing with the error
rewrite or internal redirection cycle while internally redirecting to "/index.html"
. It's not a very rare error, and I saw two listed solutions for fixing it: This Stack Overflow suggests adding a 404 to thetry_files
, which would indeed fix the redirect cycle, but I think I will start with restoring a dedicated location block for/index.html
as described in this StackExchange thread with the hope of getting a more helpful error out of it.The 404 (and the issues from the first PR linked above) were caused by the lost root directive in the
/
location block, because I was following the vite-pwa sample code, where it was not listed, presumably because it would be assumed to be set under the server block, while we had been setting it in each location individually.This caused the 404 loop on index.html and the errors (missing translations, inability to find the webmanifest and service worker file) from the first PR.
Jira link: https://lite-farm.atlassian.net/browse/LF-3921
Type of change
How Has This Been Tested?
Got pretty frustrated with testing on merge so started testing with the the local-docker branch I had made a while ago to test something else. It did repro the internal sever error and the fix resolved it.
Checklist: