allow change external https redirect port with HTTPS_REDIRECT_PORT
This commit is contained in:
parent
c8a6785898
commit
6622e4cb25
2 changed files with 10 additions and 1 deletions
|
@ -292,6 +292,12 @@ site after changing this setting, your browser has probably cached the HSTS poli
|
||||||
redirecting you back to HTTPS. You will need to clear your browser's HSTS cache or use an incognito
|
redirecting you back to HTTPS. You will need to clear your browser's HSTS cache or use an incognito
|
||||||
window / different browser.
|
window / different browser.
|
||||||
|
|
||||||
|
### HTTPS External redirect port
|
||||||
|
|
||||||
|
By default when `HTTPS_METHOD=redirect`. nginx will redirect connections on port HTPP 80 to default HTTPS 443 port, with `HTTPS_REDIRECT_PORT=port` you can change this behavior to another port, for example `HTTPS_REDIRECT_PORT=8443`
|
||||||
|
|
||||||
|
### HSTS
|
||||||
|
|
||||||
By default, [HTTP Strict Transport Security (HSTS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security)
|
By default, [HTTP Strict Transport Security (HSTS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security)
|
||||||
is enabled with `max-age=31536000` for HTTPS sites. You can disable HSTS with the environment variable
|
is enabled with `max-age=31536000` for HTTPS sites. You can disable HSTS with the environment variable
|
||||||
`HSTS=off` or use a custom HSTS configuration like `HSTS=max-age=31536000; includeSubDomains; preload`.
|
`HSTS=off` or use a custom HSTS configuration like `HSTS=max-age=31536000; includeSubDomains; preload`.
|
||||||
|
|
|
@ -216,6 +216,9 @@ upstream {{ $upstream_name }} {
|
||||||
{{/* Get the HTTPS_METHOD defined by containers w/ the same vhost, falling back to "redirect" */}}
|
{{/* Get the HTTPS_METHOD defined by containers w/ the same vhost, falling back to "redirect" */}}
|
||||||
{{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) (or $.Env.HTTPS_METHOD "redirect") }}
|
{{ $https_method := or (first (groupByKeys $containers "Env.HTTPS_METHOD")) (or $.Env.HTTPS_METHOD "redirect") }}
|
||||||
|
|
||||||
|
{{/* Get the HTTPS_REDIRECT_PORT defined by containers w/ the same vhost, falling back to "443" */}}
|
||||||
|
{{ $https_redirect_port := or (first (groupByKeys $containers "Env.HTTPS_REDIRECT_PORT")) (or $.Env.HTTPS_REDIRECT_PORT "443") }}
|
||||||
|
|
||||||
{{/* Get the SSL_POLICY defined by containers w/ the same vhost, falling back to empty string (use default) */}}
|
{{/* Get the SSL_POLICY defined by containers w/ the same vhost, falling back to empty string (use default) */}}
|
||||||
{{ $ssl_policy := or (first (groupByKeys $containers "Env.SSL_POLICY")) "" }}
|
{{ $ssl_policy := or (first (groupByKeys $containers "Env.SSL_POLICY")) "" }}
|
||||||
|
|
||||||
|
@ -262,7 +265,7 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
return 301 https://$host$request_uri;
|
return 301 https://$host:{{ $https_redirect_port }}$request_uri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue