mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-14 14:56:27 +03:00
fastcgi: Set SERVER_PORT to 80 or 443 depending on scheme (#4572)
This commit is contained in:
parent
bbad6931e3
commit
de490c7cad
1 changed files with 7 additions and 2 deletions
|
@ -296,10 +296,15 @@ func (t Transport) buildEnv(r *http.Request) (envVars, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// compliance with the CGI specification requires that
|
// compliance with the CGI specification requires that
|
||||||
// SERVER_PORT should only exist if it's a valid numeric value.
|
// the SERVER_PORT variable MUST be set to the TCP/IP port number on which this request is received from the client
|
||||||
// Info: https://www.ietf.org/rfc/rfc3875 Page 18
|
// even if the port is the default port for the scheme and could otherwise be omitted from a URI.
|
||||||
|
// https://tools.ietf.org/html/rfc3875#section-4.1.15
|
||||||
if reqPort != "" {
|
if reqPort != "" {
|
||||||
env["SERVER_PORT"] = reqPort
|
env["SERVER_PORT"] = reqPort
|
||||||
|
} else if requestScheme == "http" {
|
||||||
|
env["SERVER_PORT"] = "80"
|
||||||
|
} else if requestScheme == "https" {
|
||||||
|
env["SERVER_PORT"] = "443"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some web apps rely on knowing HTTPS or not
|
// Some web apps rely on knowing HTTPS or not
|
||||||
|
|
Loading…
Reference in a new issue