location: fix broken redirects behind reverse proxy (https://host:80)#279
Open
Avatarsia wants to merge 1 commit into
Open
location: fix broken redirects behind reverse proxy (https://host:80)#279Avatarsia wants to merge 1 commit into
Avatarsia wants to merge 1 commit into
Conversation
Location::__construct() built the absolute redirect URL from SERVER_NAME and SERVER_PORT, always appending the port. Behind a TLS-terminating reverse proxy (nginx/openresty -> backend on port 80, X-Forwarded-Proto: https) every Location redirect pointed to https://host:80/... - the browser then attempts a TLS handshake against the plain-HTTP port and fails with an SSL error. Prefer HTTP_HOST (host and port exactly as the client addressed them, same as the existing nginx "_" special case) and only fall back to SERVER_NAME, appending SERVER_PORT solely for non-standard ports. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Avatarsia
pushed a commit
to Avatarsia/OpenXE
that referenced
this pull request
Jun 10, 2026
…nches Upstream PR OpenXE-org#279 - Location redirects behind a TLS-terminating reverse proxy pointed to https://host:80/... causing SSL errors after actions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Avatarsia
pushed a commit
to Avatarsia/OpenXE
that referenced
this pull request
Jun 10, 2026
…nches Upstream PR OpenXE-org#279 - Location redirects behind a TLS-terminating reverse proxy pointed to https://host:80/... causing SSL errors after actions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Lokal getestet und damit ist es nicht mehr notwendig in den Settings, den Server anzugeben |
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.
Problem
Location::__construct()(www/lib/class.location.php) baut die absolute Redirect-URL ausSERVER_NAMEundSERVER_PORTund haengt den Port immer an:Hinter einem TLS-terminierenden Reverse Proxy (nginx/openresty → Backend auf Port 80,
X-Forwarded-Proto: https) zeigt damit jederLocation:-Redirect (z.B. nach Artikel einlagern) auf:Der Browser macht einen TLS-Handshake gegen den Klartext-HTTP-Port → SSL-Fehler. Fuer den Anwender sieht das wie ein ungueltiges Zertifikat aus, obwohl Zertifikat und Server in Ordnung sind.
Fix
HTTP_HOSTbevorzugen — enthaelt Host und ggf. Port exakt so, wie der Client sie adressiert hat (gleiches Muster wie der bereits vorhandene Nginx-"_"-Sonderfall eine Zeile darueber). Fallback aufSERVER_NAMEnur noch, wennHTTP_HOSTfehlt, und dortSERVER_PORTnur bei Nicht-Standard-Ports anhaengen (gleiches Muster wie derSERVER_ADDR-Zweig darunter).Verifikation
Standalone-Test der Klasse mit gemocktem
$app, 8 Szenarien (getServer()+getLocationUrl()):https://host:80/...❌https://host/...✅http://host:80/...http://host/...✅https://host:443/...https://host/...✅http://host:8080/...✅http://host:8080/...✅:80❌ /:8080✅:8080✅SERVER_NAME="_"php -lsauber. Reproduziert und verifiziert auf produktiver Instanz hinter openresty.🤖 Generated with Claude Code