Welcome! Log In Create A New Profile


https and the Host header

August 25, 2010 12:27PM
I am using Nginx as a proxy in front of a Java application (because it's hosted at Amazon where we only get one IP address per system, and I am running multiple sites).

When the application calls getRequestURL, it gets http://dev.mysite.com regardless of whether the request was actually http or https.

I am guessing that this is because Host gets set to either $host or $http_host, both of which are dev.mysite.com, and somewhere along the way an assumption gets made that that is http. I have tried setting Host to https://dev.mysite.com but that returns a completely empty page - I assume that means it's an invalid value for the Host header.

I have spent quite a bit of time researching this and I have found that Django users experience a similar problem and the fix is to add a header like X-Url-Scheme and pass along the value of $scheme, which will be https at the appropriate times. However, I don't see other Java users reporting similar problems, and the fix seems kind of kludgy to me.

Does this mean I have something configured incorrectly, or is this just the way it works? And if so is the above the best way to work around it?

Thanks in advance!
Subject Author Posted

https and the Host header

janine August 25, 2010 12:27PM

Re: https and the Host header

ThomasLohner August 26, 2010 12:36PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 180
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready