Adds support for root redirection, and improves rewrite documentation

This commit is contained in:
Ricardo Pchevuzinske Katz 2017-03-13 12:03:47 -03:00
parent c41e6bd82f
commit 0e5d3ca9e9
4 changed files with 76 additions and 11 deletions

View file

@ -177,7 +177,7 @@ If the application contains relative links it is possible to add an additional a
If the Application Root is exposed in a different path and needs to be redirected, the annotation `ingress.kubernetes.io/app-root` might be used.
Please check the [rewrite](examples/rewrite/README.md) example.
Please check the [rewrite](/examples/rewrite/README.md) example.
### Rate limiting

View file

@ -236,9 +236,17 @@ http {
ssl_verify_client on;
ssl_verify_depth {{ $location.CertificateAuth.ValidationDepth }};
{{ end }}
{{ if (or $location.Redirect.ForceSSLRedirect (and (not (empty $server.SSLCertificate)) $location.Redirect.SSLRedirect)) }}
# enforce ssl on server side
if ($pass_access_scheme = http) {
return 301 https://$host$request_uri;
}
{{ end }}
{{ if not (empty $location.Redirect.AppRoot)}}
location = / {
return 302 ${{ location.Redirect.AppRoot }};
if ($uri = /) {
return 302 {{ $location.Redirect.AppRoot }};
}
{{ end }}
{{ if not (empty $authPath) }}
@ -283,12 +291,7 @@ http {
error_page 401 = {{ $location.ExternalAuth.SigninURL }};
{{ end }}
{{ if (or $location.Redirect.ForceSSLRedirect (and (not (empty $server.SSLCertificate)) $location.Redirect.SSLRedirect)) }}
# enforce ssl on server side
if ($pass_access_scheme = http) {
return 301 https://$host$request_uri;
}
{{ end }}
{{/* if the location contains a rate limit annotation, create one */}}
{{ $limits := buildRateLimit $location }}
{{ range $limit := $limits }}