Problem with 'Host' http header when using ssl

Ivan Artyukhin nginx-forum at nginx.us
Wed Nov 5 17:04:04 UTC 2014


I'm using Nginx as reverse proxy with SSL termination. The J2EE application
that is behind it sometimes uses host information to create URLs for popup
windows. Right now it inserts name of my upstream into URL and popup windows
are not launched (obviously). I understand that i have to fill 'Host' header
with appropriate value. So I tried to use 
proxy_set_header        Host            $host;
inside my 'location' block. It works perfectly when I'm connecting over
http. By when I'm connection over https it doesn't work (even more - all
pages are not available). 
My configuration:
   upstream BE {
                  ip_hash;
		  server ...  max_fails=1 fail_timeout=300s;
		  server ... max_fails=1 fail_timeout=300s;		  
    }    

server {
        listen       443 ssl;
        server_name  localhost;

location / {
            proxy_pass http://BE;
		        # proxy_redirect           off;
			
			#proxy_set_header X-Forwarded-Proto https;
			#proxy_set_header        X-Real-IP       $remote_addr;
			#proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
			#    proxy_set_header Host $host;				
        }

I found this post   
http://forum.nginx.org/read.php?2,228638,228640#msg-228640
but it is not resolved.

Regards,
Ivan

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254615,254615#msg-254615



More information about the nginx mailing list