Welcome! Log In Create A New Profile

Advanced

Re: too many redirects

November 22, 2014 01:04AM
Hi guys,

if ($scheme = "http") {
return 301 https://$server_name$request_uri;
}

Did the job indeed !

Thanks again all for your time and patience !

All the best !


2014-11-21 20:29 GMT+01:00 Francis Daly <francis@daoine.org>:

> On Fri, Nov 21, 2014 at 09:02:01AM +0100, JACK LINKERS wrote:
>
> Hi there,
>
> > As you can see, the template doesn't make separate server blocks for each
> > HTTP & HTTPS protocole :
>
> This part is still true:
>
> > > What you probably want is:
> > >
> > > listen on http; redirect everything to https.
> > > listen on https; process requests normally.
>
> but your particular access to configure nginx does not appear to allow
> you do that.
>
> The right answer is for you to change your access to configure nginx;
> but that is unlikely to happen in the short term.
>
> You can use an alternative config, along the lines of:
>
> listen on http and https; if the request was http, redirect to https;
> else process requests normally
>
> That will probably fit your restricted configuration model.
>
> Add a stanza at server{} level, outside all location{}s
>
> if ($scheme = "http") {
> return 301 https://$server_name$request_uri;
> }
>
> and reload, and see if that does what you want.
>
> You may want to replace $server_name with $host or your preferred host
> name directly, depending on what exactly you want.
>
> But it should get over the infinite loop of your original config.
>
> f
> --
> Francis Daly francis@daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

too many redirects

shiroweb November 20, 2014 03:24AM

Re: too many redirects

dewanggaba November 20, 2014 03:28AM

Re: too many redirects

B.R. November 20, 2014 03:52AM

Re: too many redirects

shiroweb November 20, 2014 04:28AM

Re: too many redirects

shiroweb November 20, 2014 04:08PM

Re: too many redirects

B.R. November 20, 2014 05:28PM

Re: too many redirects

GreenGecko November 20, 2014 05:32PM

Re: too many redirects

Francis Daly November 20, 2014 07:10PM

Re: too many redirects

shiroweb November 21, 2014 03:04AM

Re: too many redirects

Francis Daly November 21, 2014 02:32PM

Re: too many redirects

shiroweb November 22, 2014 01:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 329
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready