Welcome! Log In Create A New Profile


Forward proxy preserving the domain

July 03, 2014 09:31PM
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; # 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?

PS: what in the world are the formatting codes for this forum? [code]...[/code] doesn't work; not even [b]...[/b] does. Yeah, sorry for not indenting my code above - no idea how to do it.
Subject Author Posted

Forward proxy preserving the domain

dandv July 03, 2014 09:31PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 96
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready