Host header is mandatory

This commit is contained in:
Manuel de Brito Fontes 2017-04-24 15:02:45 -03:00
parent 9eefb08ce9
commit 29c849f993
2 changed files with 9 additions and 1 deletions

View file

@ -158,6 +158,8 @@ http {
port_in_redirect off; port_in_redirect off;
ssl_protocols {{ $cfg.SSLProtocols }}; ssl_protocols {{ $cfg.SSLProtocols }};
proxy_ssl_protocols {{ $cfg.SSLProtocols }};
proxy_ssl_session_reuse on;
# turn on session caching to drastically improve performance # turn on session caching to drastically improve performance
{{ if $cfg.SSLSessionCache }} {{ if $cfg.SSLSessionCache }}
@ -175,6 +177,7 @@ http {
# allow configuring custom ssl ciphers # allow configuring custom ssl ciphers
ssl_ciphers '{{ $cfg.SSLCiphers }}'; ssl_ciphers '{{ $cfg.SSLCiphers }}';
ssl_prefer_server_ciphers on; ssl_prefer_server_ciphers on;
proxy_ssl_ciphers {{ $cfg.SSLCiphers }};
{{ end }} {{ end }}
{{ if not (empty $cfg.SSLDHParam) }} {{ if not (empty $cfg.SSLDHParam) }}
@ -278,6 +281,8 @@ http {
proxy_set_header X-Scheme $pass_access_scheme; proxy_set_header X-Scheme $pass_access_scheme;
{{ end }} {{ end }}
proxy_pass_request_headers on; proxy_pass_request_headers on;
proxy_set_header Host {{ $location.ExternalAuth.Host }};
proxy_ssl_server_name on;
set $target {{ $location.ExternalAuth.URL }}; set $target {{ $location.ExternalAuth.URL }};
proxy_pass $target; proxy_pass $target;
} }

View file

@ -38,7 +38,9 @@ const (
// External returns external authentication configuration for an Ingress rule // External returns external authentication configuration for an Ingress rule
type External struct { type External struct {
URL string `json:"url"` URL string `json:"url"`
// Host contains the hostname defined in the URL
Host string `json:"host"`
SigninURL string `json:"signinUrl"` SigninURL string `json:"signinUrl"`
Method string `json:"method"` Method string `json:"method"`
SendBody bool `json:"sendBody"` SendBody bool `json:"sendBody"`
@ -129,6 +131,7 @@ func (a authReq) Parse(ing *extensions.Ingress) (interface{}, error) {
return &External{ return &External{
URL: str, URL: str,
Host: ur.Hostname(),
SigninURL: signin, SigninURL: signin,
Method: m, Method: m,
SendBody: sb, SendBody: sb,