Cloak a hostname

Is it possible assuming I have a domain and uri:

http://foo.bar/candy

To have the browser location still show http://foo.bar/candy but
actually
fetch the content from:

http://newdomain.com/candy

I.E. simply replace the host. Assume I have:

server {
listen 443;
server_name foo.bar;

root /srv/www/domains/foo.bar;
index index.html;

location / {

}

}

Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,248288,248288#msg-248288

Is it possible assuming I have a domain and uri:

http://foo.bar/candy

To have the browser location still show http://foo.bar/candy but actually
fetch the content from:

http://newdomain.com/candy

If your server runs on foo.bar then:

server {
location / {
proxy_pass http://newdomain.com;
}
}

p.s. though It depends if the returned content contains relative or full
urls - then you might/can in combination with the proxy_pass use also
the
Sub module ( http://nginx.org/en/docs/http/ngx_http_sub_module.html ) -
egg
add something like:

sub_filter //newdomain.com //foo.bar;
sub_filter_once off;

rr

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs