Welcome! Log In Create A New Profile

Advanced

Re: $scheme

Slava Kokorin
January 27, 2011 03:44AM
27 января 2011 г. 11:39 пользователь Slava Kokorin
<slava.kokorin@gmail.com>написал:

> 27 января 2011 г. 6:23 пользователь User <nginx-forum@nginx.us> написал:
>
> Всем привет!
>> Настраиваю автоматический редирект на
>> https. При вот таком варианте
>> [code]
>> if ($scheme = 'http')
>> {
>> rewrite ^(.*)$ https://xxxxxxx.ru$1 permanent;
>> }
>> [/code]
>> редирект идет постоянно, как для
>> обращений по http, так и для https... В чем
>> фишка?
>>
>
> Вообще считается что if is evil.
>
> Я делаю так - и всё работает.
>
> server {
> listen 80;
> server_name whatever_you_want_to_redirect.com;
> rewrite ^ https://
>

Сорри, не дописал. Итак, вот пример.

server {
listen 80;
server_name whatever_you_want_to_redirect.com;
rewrite ^ https://whatever_you_want_to_redirect.com permanent;
## rewrite ^ https://$host permanent; ## Possible this will work
as well and more general
}




>
>
>> Posted at Nginx Forum:
>> http://forum.nginx.org/read.php?21,169949,169949#msg-169949
>>
>>
>> _______________________________________________
>> nginx-ru mailing list
>> nginx-ru@nginx.org
>> http://nginx.org/mailman/listinfo/nginx-ru
>>
>
>
>
> --
> Regards,
> Slava
>



--
Regards,
Slava
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

$scheme

User January 26, 2011 10:23PM

Re: $scheme

Vladimir Rusinov January 27, 2011 12:52AM

Re: $scheme

User January 27, 2011 03:21AM

Re: $scheme

User January 27, 2011 09:04PM

Re: $scheme

User January 28, 2011 05:16AM

Re: $scheme

Slava Kokorin January 27, 2011 03:40AM

Re: $scheme

Slava Kokorin January 27, 2011 03:44AM

Re: $scheme

Vladimir Rusinov January 27, 2011 04:30AM

Re: $scheme

Vladimir Rusinov January 28, 2011 04:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 168
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready