Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LF-3921d Fix nginx 'rewrite or internal redirection cycle while internally redirecting to "/index.html"' error #3030

Conversation

kathyavini
Copy link
Collaborator

@kathyavini kathyavini commented Dec 6, 2023

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 the try_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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

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:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@kathyavini kathyavini requested review from a team as code owners December 6, 2023 23:32
@kathyavini kathyavini requested review from antsgar and SayakaOno and removed request for a team December 6, 2023 23:32
@kathyavini kathyavini self-assigned this Dec 6, 2023
@kathyavini kathyavini added the bug Something isn't working label Dec 6, 2023
I think the location blocks are only supposed to be used if there is a per location override
@kathyavini kathyavini changed the title LF-3921d Restore index.html location block LF-3921d Fix nginx 'rewrite or internal redirection cycle while internally redirecting to "/index.html"' error Dec 6, 2023
I had missed them initially and would like to include them for completeness. I saw no effect in my local testing
…w.js

I was able to repro locally all the bugs from the first PR with the root directive issue. These location blocks were not to blame
@SayakaOno SayakaOno merged commit e3ba0b1 into integration Dec 7, 2023
2 checks passed
antsgar pushed a commit that referenced this pull request Dec 12, 2023
…guration-to-match-vite-pwa-recommendations

LF-3921d Fix nginx 'rewrite or internal redirection cycle while internally redirecting to "/index.html"' error
antsgar pushed a commit that referenced this pull request Dec 12, 2023
…guration-to-match-vite-pwa-recommendations

LF-3921d Fix nginx 'rewrite or internal redirection cycle while internally redirecting to "/index.html"' error
antsgar pushed a commit that referenced this pull request Dec 13, 2023
…guration-to-match-vite-pwa-recommendations

LF-3921d Fix nginx 'rewrite or internal redirection cycle while internally redirecting to "/index.html"' error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants