Nginx proxy hangs when proxiing to itself

Posted by Thomas on Server Fault See other posts from Server Fault or by Thomas
Published on 2013-11-09T21:12:54Z Indexed on 2013/11/09 21:56 UTC
Read the original article Hit count: 347

Filed under:

I have Nginx running as a proxy for a number of services including a Geoserver running on port 8080 with the following config:

   location ^~ /wms/ {
           rewrite  ^/wms/(.*)$  /geoserver/ows$1  break;
           proxy_pass http://127.0.0.1:8080;
           proxy_connect_timeout 60s;
           proxy_read_timeout 150s;
       }

and a proxy service to avoid SOP problems which works as follows:

  location ^~ /proxy/?targetURL= {
           rewrite  ^/proxy/?targetURL=(.*)$ $1  break;
           proxy_pass $1;
           proxy_connect_timeout 60s;
           proxy_read_timeout 150s;
       }

My web server is also under the same domain, ran by a jetty on port 8888, handled by the same proxy.

   location / {
           proxy_pass http://127.0.0.1:8888;
           proxy_connect_timeout 60s;
           proxy_read_timeout 150s;
       }

From my web application I make WMS server calls for data via my proxy service. It works fine for external servers but it hangs when I call my own internal geoserver. My geoserver proxy works fine, I can make WMS service queries with the said URL.

The call that hangs is basically:

http://mywebappdomain.com/proxy/?targetURL=http://mywebappdomain.com/wms/?my_set_of_parameters

Which means that the proxy rule applies and the WMS service is called from the same server.

Is there an issue with proxying over itself?

© Server Fault or respective owner

Related posts about nginx