From 0badc6cb5dbfb2615972e30edb18896d89f252d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BA=E5=8D=9A?= Date: Fri, 9 Jun 2017 16:16:00 +0800 Subject: [PATCH] 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. --- .../nginx/rootfs/etc/nginx/template/nginx.tmpl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index 55dde3f4e..c7cafb697 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -137,12 +137,12 @@ http { map $pass_access_scheme $the_x_forwarded_for { default $remote_addr; - https $proxy_protocol_addr; + # https $proxy_protocol_addr; } map $pass_access_scheme $the_real_ip { default $remote_addr; - https $proxy_protocol_addr; + # https $proxy_protocol_addr; } # map port 442 to 443 for header X-Forwarded-Port @@ -165,13 +165,19 @@ http { xml application/xml; text text/plain; } - - # Obtain best http host - map $http_host $best_http_host { - default $http_host; + + # Obtain CUSTOM host (PHOST) + map $http_phost $best_http_host { + default $http_phost; '' $host; } + # Obtain best http host + #map $http_host $best_http_host { + # default $http_host; + # '' $host; + #} + server_name_in_redirect off; port_in_redirect off;