Skip to content

fix(web): disable absolute_redirect in nginx to avoid leaking internal URL - #991

Open
epipra wants to merge 1 commit into
NdoleStudio:mainfrom
epipra:fix-nginx-absolute-redirect
Open

fix(web): disable absolute_redirect in nginx to avoid leaking internal URL#991
epipra wants to merge 1 commit into
NdoleStudio:mainfrom
epipra:fix-nginx-absolute-redirect

Conversation

@epipra

@epipra epipra commented Sep 6, 2026

Copy link
Copy Markdown

Summary

  • nginx's default absolute_redirect guesses scheme/host/port from its own listen directive when emitting directory redirects (e.g. /blog -> /blog/)
  • Behind a reverse proxy that terminates TLS and forwards to this container over plain HTTP (Caddy, nginx, Traefik, etc. in front — a common self-host setup), that produces a Location header like http://<container-host>:3000/blog/ sent straight to real visitors instead of the public https:// URL
  • Setting absolute_redirect off makes nginx emit a relative redirect instead, which the browser resolves against the actual request URL

Test plan

  • Deploy behind a reverse proxy that terminates TLS and forwards over HTTP
  • curl -sI https://<host>/blog and confirm the Location header is relative (/blog/), not an internal http://host:port/blog/ URL

…l URL

nginx's default absolute_redirect guesses scheme/host/port from its own
listen directive when emitting directory redirects (e.g. /blog -> /blog/).
Behind a reverse proxy that terminates TLS and forwards to this container
over plain HTTP (Caddy, nginx, Traefik, etc. in front), that produces a
Location header like http://<container-host>:3000/blog/ sent straight to
real visitors instead of the public https:// URL. Setting
absolute_redirect off makes nginx emit a relative redirect instead, which
the browser resolves against the actual request URL.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


root seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR prevents nginx from exposing its internal scheme, host, and port when generating directory redirects behind a TLS-terminating reverse proxy.

  • Adds absolute_redirect off to the web server configuration.
  • Causes redirects such as /blog to use a relative Location: /blog/.
  • Documents the reverse-proxy scenario motivating the configuration.

Confidence Score: 5/5

The PR appears safe to merge and correctly limits nginx-generated redirects to relative locations.

The directive is supported by the configured nginx image, valid in the server context, and no callers or deployments were found that depend on absolute redirect locations.

Important Files Changed

Filename Overview
web/nginx.conf Disables absolute nginx-generated redirects to preserve the visitor-facing origin and avoid leaking internal proxy details.

Reviews (1): Last reviewed commit: "fix(web): disable absolute_redirect in n..." | Re-trigger Greptile

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@AchoArnold

Copy link
Copy Markdown
Member

Hello @epipra
Can you sign the CLA?

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.

3 participants