question regarding rewrite from http to https

Igor Sysoev is at rambler-co.ru
Wed Jun 11 17:01:27 MSD 2008


On Wed, Jun 11, 2008 at 04:29:11AM -0700, Mansoor Peerbhoy wrote:

> Hello,
> 
> I am using NGINX as an HTTP proxy, and in some cases, I need to rewrite all requests from http:// to https://
> My proxy configuration has two server {} blocks, one with http, and one with https
> 
> So if my sample configuration looks like: (assume proxy server name is proxy.com)
> 
> server
> {
>   listen 80;
>   location /
>   {
>     rewrite ^/(.*)$ https://proxy.com/$1;

-     rewrite ^/(.*)$ https://proxy.com/$1;
+     rewrite ^/(.*)$ https://proxy.com/$1  redirect;

>   }
> }
> 
> server 
> {
>   listen 443;
>   ...
> }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list