too many redirects

JACK LINKERS jacklinkers at gmail.com
Sat Nov 22 06:03:35 UTC 2014


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 at 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 at daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141122/a39d7601/attachment.html>


More information about the nginx mailing list