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;
}
Backend correctly analyzes ‘host’ header. To check it I created simple
ServletFilter to ‘set’ this header and after it backend forms correct
URLs.
So my problem will be solved if I manage to set ‘host’ header in nginx
configuration. I’m still confused why I can set this header for non-SSL
port
and I can’t do it for SSL. What am I missing?