Proxy/Redirect issue

Phil Bayfield phil at techlightenment.com
Wed Nov 17 19:11:08 MSK 2010


I have setup an nginx proxy with a couple of servers behind it, also running
nginx.

For the most part everything works nicely, although I have a strange issue.

I have my domains setup with a wildcard CNAME record so any subdomain should
work.

I have a couple of vhosts setup intitially domain1.com and domain2.com which
work fine.

I have tried to redirect any requests from sub domains of these 2 domains as
follows:

server {
        listen 80;
        server_name *.domain1.com;
        rewrite ^/(.*)$ http://domain1.com/$1 permanent;
}

I also tried using a check against the hostname.

The problem is the redirect works for domain1.com, but not for domain2.com,
any request to something.domain2.com is redirected to domain1.com.

Can anyone help resolve this?

Thanks
Phil.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20101117/3128fcd6/attachment-0001.html>


More information about the nginx mailing list