fix: preserve forwarded app origin on nginx redirects - #39
Merged
Conversation
…irectly at the source
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #38.
Root cause
Generated Expo web exports can contain route directories such as
products/index.html. The generated nginx config usestry_files $uri $uri/ /index.html, so a request for/productscan resolve to the real/products/directory and nginx emits its canonical trailing-slash redirect. Because nginx listens on the internal container port8080, its default absolute redirect can leak that internal port through akubectl port-forwardwhose browser-visible local port is different.Fix
Apply
absolute_redirect off;to the generated app nginx server. Nginx then emits relative redirects such as/products/, so the browser keeps the exact externally requested scheme/host/port while Expo Router's semantic/productsroute and static export layout remain unchanged.The Minikube adapter applies this as a serving policy to the generated app image artifact and fails fast if the expected generated nginx Dockerfile is missing or its listen directive changes unexpectedly.
Coverage
Adds regression coverage that generated Minikube app images:
try_filesbehavior;port_in_redirect off, which would still lose a non-default external forwarded port.Includes a patch changeset.