Skip to content

fix: preserve forwarded app origin on nginx redirects - #39

Merged
artiphishle merged 17 commits into
mainfrom
fix/preserve-forwarded-app-origin
Jul 22, 2026
Merged

fix: preserve forwarded app origin on nginx redirects#39
artiphishle merged 17 commits into
mainfrom
fix/preserve-forwarded-app-origin

Conversation

@artiphishle

Copy link
Copy Markdown
Contributor

Fixes #38.

Root cause

Generated Expo web exports can contain route directories such as products/index.html. The generated nginx config uses try_files $uri $uri/ /index.html, so a request for /products can resolve to the real /products/ directory and nginx emits its canonical trailing-slash redirect. Because nginx listens on the internal container port 8080, its default absolute redirect can leak that internal port through a kubectl port-forward whose 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 /products route 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:

  • disable absolute nginx redirects;
  • keep the existing Expo static-route try_files behavior;
  • do not use port_in_redirect off, which would still lose a non-default external forwarded port.

Includes a patch changeset.

@artiphishle artiphishle self-assigned this Jul 22, 2026
@artiphishle
artiphishle merged commit aba801b into main Jul 22, 2026
1 check passed
@artiphishle
artiphishle deleted the fix/preserve-forwarded-app-origin branch July 22, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve external forwarded origin when reloading generated app routes

1 participant