Redirect request based on source $scheme !!

shahzaib shahzaib shahzaib.cb at
Wed Nov 11 10:25:11 UTC 2015

>>you can create separate server blocks for each domain
I think issue will still persist. Say makes static
call to , it'll end up with conflicted scheme i.e
https -> http. We can't force http to https as well because it'll break
static calls from http -> http.

Actually we've video sharing website from where people embed http/https
links to there websites. Now the problem is, some of the HTTPS  websites
have embedded HTTP URL links from our website instead of HTTPS due to which
the code is unable to execute on their HTTPS website because it is making
call from https -> http which is wrong. The number of these malformed links
are huge and there's no way that those users can manually correct
the embedded links by editing http to https and vice versa).

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.

On Wed, Nov 11, 2015 at 3:10 PM, Avraham Serour <tovmeod at> wrote:

> you can create separate server blocks for each domain
> On Wed, Nov 11, 2015 at 11:36 AM, shahzaib shahzaib <shahzaib.cb at
> > wrote:
>> Hi,
>>    Is there a way we can serve $scheme (HTTP/HTTPS) based on source
>> request ? Such as :
>> if --> sends request to (as
>> it'll fail due to cross  $scheme conflict)
>> So will check that the request invoked using https
>> $scheme and it'll redirect to
>> for that particular
>> ---------------------------------------------------------
>> Is that possible guys ?
>> Thanks in Advance !
>> Regards.
>> Shahzaib
>> Need to send me private email? I use Virtru
>> <>.
>> _______________________________________________
>> nginx mailing list
>> nginx at
> _______________________________________________
> nginx mailing list
> nginx at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list