trouble with forward proxying

jfix nginx-forum at
Fri May 6 20:16:55 MSD 2011

Hello, I've looked far and wide but couldn't find an answer to my

Here's a quick description: an appserver must use the company's http
proxy for outgoing http requests, but cannot be configured. So I (tried)
set up nginx to act as a forward proxy, like this:

server {
	listen 9099;
	location / 		{
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Host $http_host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

	error_log	/cygdrive/E/data/logs/forward-proxy-nginx-error.log	debug;
	access_log  /cygdrive/E/data/logs/forward-proxy-nginx-access.log 
combined buffer=32k;

I couldn't find any config examples where the parent proxy is used in
the proxy_pass directive. 

It seems like there is no other way to specify the company proxy than to
add it to the proxy_pass directive. 

The error message I get is this, apparently, nginx looks for a colon and
takes the rest as the port number:

2011/05/06 18:01:32 [error] 2420#0: *1 invalid port in upstream
"proxy.example.org", client:, server: ,
request: "GET HTTP/1.1", host: ""

If I change the proxy_pass directive to 


it's the parent proxy that complains that a URL cannot start with a /

The following error was encountered while trying to retrieve the URL: <a

I'm at a loss how to continue. Could somebody please help?  Thanks very
much in advance, Jakob.

Posted at Nginx Forum:,196115,196115#msg-196115

More information about the nginx mailing list