I feel like I must be missing something obvious... but here goes.
Question
Is it possible to configure an Nginx proxy such that it does not modify the HTTP request URI? How?
Background
I have an Nginx reverse proxy (A) in front of a forward proxy (B).
The configuration at A is a plain vanilla reverse proxy setup that looks something like this:
upstream upstreamproxy {
server 192.168.0.69:80;
}
location / {
proxy_set_header Host $http_host;
proxy_pass http://upstreamproxy;
proxy_redirect off;
proxy_buffering off;
}
The forward proxy B is also plain vanilla, so it's expecting to see proxy requests like this:
GET http://www.example.com/foo HTTP/1.1
User-Agent: curl/7.30.0
Host: www.example.com
Accept: */*
Proxy-Connection: Keep-Alive
The problem is, reverse proxy A rewrites the HTTP request URI as shown:
Issue an example request:
my-client$ curl --proxy http://<proxy-A IP address>:80 http://www.example.com/foo
Look at what Proxy A is doing:
proxy-A$ ngrep -W byline tcp and port 80
####
T <my-client IP address>:38038 -> <proxy-A IP address>:80 [AP]
GET http://www.example.com/foo HTTP/1.1.
User-Agent: curl/7.30.0.
Host: www.example.com.
Accept: */*.
Proxy-Connection: Keep-Alive.
.
#####
T <proxy-A IP address>:57211 -> 192.168.0.69:80 [AP]
GET /foo HTTP/1.0.
Host: www.example.com.
Connection: close.
User-Agent: curl/7.30.0.
Accept: */*.
Proxy-Connection: Keep-Alive.
Note that the request URI was rewritten from http://www.example.com/foo
to /foo
. That's what I'm trying to avoid.
FWIW, I've tried fiddling around with the uri
portion of the proxy_pass URL
without success.