Forum: NGINX reverse proxy through upstream proxy

2974d09ac2541e892966b762aad84943?d=identicon&s=25 pba (Guest)
on 2014-05-31 05:04
(Received via mailing list)
I'm trying to configure nginx as a reverse proxy where the upstream
traffic
has to go through another proxy (squid in this case) without success.
Since
nginx does not support (as far as I can tell) passing a proxy for
upstream
and because I need to reverse proxy only one domain (test.com) I've
tried
rewriting the URL and using proxy pass:

location / {
   rewrite ^ http://test.com$request_uri;
   proxy_set_header X-Custom SOMETOKEN;
   proxy_pass http://my_squid:3128;
}

Unfortunately since the final URL generated by rewrite starts with http
nginx immediately returns a 302 without forwarding the request to the
proxy.

Any ideas how to solve this or if there are alternative solutions to
what
I'm trying to achieve ?

Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250513,250513#msg-250513
36a8284995fa0fb82e6aa2bede32adac?d=identicon&s=25 Francis Daly (Guest)
on 2014-05-31 11:13
(Received via mailing list)
On Fri, May 30, 2014 at 11:03:42PM -0400, pba wrote:

Hi there,

> I'm trying to configure nginx as a reverse proxy where the upstream traffic
> has to go through another proxy (squid in this case) without success.

I believe that nginx as a client can speak http to a http server, and
http-over-ssl to a https server, but does not speak proxied-http to a
http proxy server.

> Any ideas how to solve this or if there are alternative solutions to what
> I'm trying to achieve ?

As I see it, you can:

(a) encourage someone to patch nginx for your use case; or

(b) configure your squid so that it responds to http, not just
proxied-http.

Option (b) is probably less work. Look for either "transparent" or
"reverse proxy" within the squid documentation, and see if it is
appropriate for your setup.

  f
--
Francis Daly        francis@daoine.org
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.