Trouble adding /pma location to all virtual hosts

B.R. reallfqq-nginx at
Thu Jun 27 19:07:57 UTC 2013

Hello again,

I resorted to the "if" control structure because, without it, the

> browser became stuck in a redirect-loop. (The reason for this is
> obvious.) Then again, I suppose that the redirect-loop would occur
> regardless of whether I use a "return 301" or "rewrite".
> How would you recommend avoiding the redirect-loop problem?
​To me, it seems that if you have an infinite llop problem, the redirect
condition is not correct.
I would redirect URI starting with 'http://' to the same starting with
'https://'. Once the 'https' location is requested, the redirect has no
effect anymore... with the supplemental benefit of Nginx automatically​

​sending a permanent 301 redirection and not a temporary 302 one (which is
the default, unless explicitly stated otherwise, if I remember well)​.

I would really prefer no to have to define separate "server" blocks for
> ports 80 and 443, due to the complex nature of the hosting environment
> in which I'm working.
> Currently, all vhosts receive:
> server {
>     listen *:80;
>     listen *:443 ssl;
> }
> Without separating ports 80 and 443 into individual "server" blocks, I
> saw no way to avoid the loop without using an "if" structure.
​IMHO, that's the sorrect way of doing things. You could also listen for
IPv6 requests :o)

> Am I missing something?
> Thanks again,
> -Ben
> _______________________________________________
> nginx mailing list
> nginx at

*B. R.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list