Detect if `trusted_proxies` and `client_ip_headers` are on, and do other header manupulation
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
The request concerns how FrankenPHP's Caddy integration handles trusted_proxies and client_ip_headers when setting $_SERVER values in the PHP SAPI, likely in the Go side where request environment variables are built. Start by locating where REMOTE_ADDR and HTTPS are populated for PHP requests and how Caddy's client IP settings reach it. Done means a design decision on a client_proto_headers-style option and tests showing X-Forwarded-Proto yields HTTPS only when trusted.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe your feature request
Is your feature request related to a problem? Please describe.
This previous discussion suggests that "FrankenPHP is not supposed to tell php the connection is https when it's not. Your application must handle the HTTP_X_FORWARDED_PROTO header, it's not the webservers job to lie to the application."
That is generally true -- when configuring following the Running being a reverse proxy instructions, FrankenPHP passes the request unmodified and application has to choose how to process it.
However, Caddy has trusted_proxies and client_ip_headers options which replace the REMOTE_ADDR value with the value provided by the proxy headers. This is convenient because the {client_ip} and other IP-based configuration can be used.
Using this option results in a situation where the application/framework's Trusted Proxies code doesn't see that the request came from a proxy -- which is exactly as desired, except that some other X-Forwarded-* values are not handled. Primarily, the X-Forwarded-Proto value is not translated to the HTTPS value in the $_SERVER superglobal, so the application/framework does not think the request came via a secure channel even though it did.
Describe the solution you'd like
It would be nice if we can detect that trusted_proxies and client_ip_headers are enabled and also process X-Forwarded-Proto. Alternatively, we may want this to be configurable and add another option - perhaps client_proto_headers - that can say which header(s) to look at, if present. (Unlike the base client_ip_headers, I do not think this can be added to Caddy itself, because the handling needs to be PHP-specific.)
Describe alternatives you've considered
There are two alternatives, which each have drawbacks:
- Tell the framework/application to "trust all proxies", so it will process the headers no matter what IP address is in
REMOTE_ADDR. This only works if traffic from non-proxy origins is completely blocked, which is not always practical. - Turn off
trusted_proxiesin Caddy/FrankenPHP, and only use the framework/application. This prevents Caddy's configuration from being able to use the real origin IP. Also, if multiple applications are used, they all need to be configured to handle proxy headers, instead of Caddy/FrankenPHP being able to do it all at once.
- Lingua principale
- Go
- Stelle
- 11.5k
- Fork
- 506
- Merge medio
- 1g 9h
- PR unite (30g)
- 63
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di php/frankenphp
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
php/frankenphp#2806 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
php/frankenphp#2671 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Include frankenphp version in logsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
php/frankenphp#2483 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
suggestion about compile.mdForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertaenhancement
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
php/frankenphp#601 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Request bodies exceeding request_body max_size are silently truncated instead of returning 413 (classic and worker)Forse già presa @dunglas l’ha presa 8 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
php/frankenphp#2781 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di php/frankenphp
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
masahitojp/mariamem#108 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Pod detail shows CPU usage ten times too high, and throws on decimal memory suffixesForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 11 giorni
-
tsuru_app_cname and tsuru_app_router don't handle removal outside terraformForse già presa @lbarrosby l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
contributor-friendly good-first-issue lang:go
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
irbis-sh/zen-desktop#870 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno