wildcard redirect

Igor Sysoev is at rambler-co.ru
Wed Aug 12 17:24:44 MSD 2009


On Wed, Aug 12, 2009 at 03:07:41PM +0200, InterNetX - J??rgen Gotteswinter wrote:

> 2009/08/12 15:04:48 [notice] 16134#0: *76 "^/(.*)" matches "/", client: 
> 62.116.135.150, server: *.xxx.com, request: "GET / HTTP/1.0", host: 
> "login.xxx.com"
> 2009/08/12 15:04:48 [notice] 16134#0: *76 rewritten redirect: 
> "https://login.xxx.com/", client: 62.116.135.150, server: *.xxx.com, 
> request: "GET / HTTP/1.0", host: "login.xxx.com"

> perhaps better readable @ http://de.pastebin.ca/1526481

You need to rebuild nginx --with-debug and set

error_log /path/to/log  debug;


> Igor Sysoev wrote:
> >On Wed, Aug 12, 2009 at 12:10:28PM +0200, Juergen Gotteswinter wrote:
> >
> >>but it loops :(
> >>
> >>heres the full part incl. ssl part
> >>
> >>
> >>  server {
> >>        listen  xxx:80;
> >>        server_name *.xxx.com;
> >>
> >>        rewrite ^/(.*) https://login.xxx.com$request_uri permanent;
> >>    }
> >>
> >>
> >>
> >>server {
> >> listen               xxxxx:443;
> >> ssl                  on;
> >> ssl_protocols        SSLv3 TLSv1;
> >> ssl_ciphers         AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
> >> ssl_certificate      /etc/nginx/ssl/www.xxx.com.crt;
> >> ssl_certificate_key  /etc/nginx/ssl/www.xxx.com.key;
> >> ssl_session_cache    shared:SSL:10m;
> >> ssl_session_timeout  10m;
> >>
> >>
> >>    server_name _;
> >>        location / {
> >>          proxy_pass http://www.xxx.com;
> >>          access_log off;
> >>          proxy_set_header X-Real-IP $remote_addr;
> >>          proxy_set_header Host $host;
> >>          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> >>        }
> >>    }
> >
> >It should work. Probably, redirect may be sent by backend.
> >Could you create debug log of the looping request ?
> >
> >>Igor Sysoev wrote:
> >>>On Wed, Aug 12, 2009 at 11:21:13AM +0200, Juergen Gotteswinter wrote:
> >>>
> >>>>Hi Igor,
> >>>>
> >>>>i got something like
> >>>>
> >>>> server {
> >>>>       listen  xxx:80;
> >>>>       server_name www.xxx.com xxx.com login.xxx.com;
> >>>>
> >>>>       rewrite ^ https://login.xxx.com$request_uri permanent;
> >>>>   }
> >>>>
> >>>>if i add *.xxx.com, or remove the other entries in server_name and just 
> >>>>leave *.xxx.com i get a redirect loop?
> >>>No, since the redirect is to :443, but the server listens on :80.
> >>>
> >>>>sorry, but i'm lil bit confused now :)
> >>>>
> >>>>Igor Sysoev wrote:
> >>>>>On Wed, Aug 12, 2009 at 09:20:37AM +0200, Juergen Gotteswinter wrote:
> >>>>>
> >>>>>>Hello Folks,
> >>>>>>
> >>>>>>is there a way to do a wildcard redirect like
> >>>>>>
> >>>>>>*.blafoo.com -> alwaysthis.com
> >>>>>>
> >>>>>>?
> >>>>>server {
> >>>>>  server_name  *.blafoo.com;
> >>>>>  rewrite      ^  http://alwaysthis.com/;
> >>>>>}
> >>>>>
> >>>>>
> >
> 
> -- 
> InterNetX GmbH
> Maximilianstrasse 6
> D-93047 Regensburg
> 
> Tel. +49 941 59559-480
> Fax  +49 941 59559-245
> 
> Gesch??ftsf??hrer/CEO: Thomas M??rz
> Amtsgericht Regensburg, HRB 7142

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





More information about the nginx mailing list