Hi,
I need to alias a subdomain to contents of an url, e.g. I need
http://abcd.domain.com/ to proxy contents of
http://www.domain.com/path1/path2/xyz
All my attempts with proxy_pass resulted in 301 to
http://abcd.domain.com/path1/path2/xyz and a 404 with strange duplicate
uri /path1/path2/xyzpath1/path2/xyz
server {
listen 11.22.33.44:80;
server_name abcd.domain.com;
location / {
proxy_pass
http://www.domain.com/path1/path2/xyz ;
}
}
I’m clearly missing something, please help!
Hi,
I think what you might need to set is ‘proxy_redirect’. I’m running a
similar setup which works this way.
Regards,
Chris
Sent from BlackBerry Device
Hi Chris,
I was missing $1 in the end of the uri so the rewrite works.
Without it, it was being silently ignored and was creating a redirect
loop.
For the mailing list archival purposes, here is what I ended up with:
server {
listen 11.22.33.44:80;
server_name abcd.domain.com;
location / {
rewrite ^(.*)$ /path1/path2/filename$1 break;
proxy_pass http://www.domain.com;
}
server_tokens off;
}
Thanks again,
Vahan
proxy_pass http://www.domain.com/path1/path2/xyz/ ;
slash (“/”) in the end.
Posted at Nginx Forum:
Hi, I need to alias a subdomain to contents of an url, e.g. I need http://abcd.domain.com/ to proxy contents of http://www.domain.com/path1/path2/xyz All my attempts with proxy_pass resulted in 301 to http://abcd.domain.com/path1/path2/xyz and a 404...
On Sat, May 12, 2012 at 04:03:57PM +0400, Vahan Y. wrote:
location / {
rewrite ^(.*)$ /path1/path2/filename$1 break;
proxy_pass http://www.domain.com;
}
server_tokens off;
}
This works without rewrites:
location / {
proxy_pass http://www.domain.com/path1/path2/filename/;
}
–
Igor S.
Damn, sometimes a single trailing slash can be a show-stopper