Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Forward proxy preserving the domain

$
0
0
[Cross-posted via the forum from the mailing list - http://forum.nginx.org/read.php?2,251449]

Basically, I want to set up a proxy running on example.mydomain.com that will take any URI, retrieve `example.com$request_uri`, and pass it on to the client, preserving my example.mydomain.com domain for the client.

So far I have this config:

server {
server_name example.mydomain.com;
location / {
resolver 8.8.8.8; # why exactly is this necessary?
proxy_pass http://example.com$request_uri;
}
}

It works, but what happens is that nginx returns a `HTTP/1.1 301 Moved Permanently` response, with `Location` set to http://example.com$request_uri. How is this different from the rewrite directive, or from `return 301 http://example.com$request_uri` ?

I want instead a straight response of the actual contents at http://example.com$request_uri. How can I do that?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>