the road of request : nginx-> nginx-ingress-> tomcat. If use https, the

first nginx use 443 port . the next nginx-ingress and tomcat use 80
port.

so nginx-ingress use "PHOST" to show the real host for backends. Removes
https support from nginx-ingress.
This commit is contained in:
贺博 2017-06-09 16:16:00 +08:00
parent d556cc07b6
commit 0badc6cb5d

View file

@ -137,12 +137,12 @@ http {
map $pass_access_scheme $the_x_forwarded_for { map $pass_access_scheme $the_x_forwarded_for {
default $remote_addr; default $remote_addr;
https $proxy_protocol_addr; # https $proxy_protocol_addr;
} }
map $pass_access_scheme $the_real_ip { map $pass_access_scheme $the_real_ip {
default $remote_addr; default $remote_addr;
https $proxy_protocol_addr; # https $proxy_protocol_addr;
} }
# map port 442 to 443 for header X-Forwarded-Port # map port 442 to 443 for header X-Forwarded-Port
@ -166,12 +166,18 @@ http {
text text/plain; text text/plain;
} }
# Obtain best http host # Obtain CUSTOM host (PHOST)
map $http_host $best_http_host { map $http_phost $best_http_host {
default $http_host; default $http_phost;
'' $host; '' $host;
} }
# Obtain best http host
#map $http_host $best_http_host {
# default $http_host;
# '' $host;
#}
server_name_in_redirect off; server_name_in_redirect off;
port_in_redirect off; port_in_redirect off;