Redirect request based on source $scheme !!

itpp2012 nginx-forum at nginx.us
Wed Nov 11 11:23:02 UTC 2015


shahzaib1232 Wrote:
-------------------------------------------------------
> So we're thinking to have some condition in place that if the request
> for
> HTTP embedded link comes from any HTTPS domain , nginx will detect
> that
> source $scheme and redirect that request to HTTPS.

The problem is you only have $request_uri (which can be anything) which
should contain whats being asked for, but there is no way to detect (map)
where it's coming from.
You could do something with Lua, do a co-socket call to its origin on https,
if that works save it in a cache, the next time you test for the cache
value.
Or get the calling party to add a header and map that back to https.

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,262719,262730#msg-262730



More information about the nginx mailing list