Newbie Question: Sharing proxy_pass config between locations

Cabbar Duzayak cabbar at gmail.com
Tue Mar 6 22:21:06 UTC 2012


Hi,

I have a basic configuration that points to a back-end server with
proxy_pass and bunch of proxy_set_header call entries. And, I have
multiple locations entries that keep doing the same thing, e.g.

        location / {
                proxy_pass              http://127.0.0.1:5000
                proxy_set_header        X-Real-IP $remote_addr;
                ... more proxy_set headers
        }

        location /x/ {
                access_log off
                proxy_pass              http://127.0.0.1:5000
                proxy_set_header        X-Real-IP $remote_addr;
                ... more proxy_set headers
        }

Is it possible to define this proxy_pass & proxy_set_headers once, and
share it between these locations? Or, do I need to keep doing this for
all?

Thanks.



More information about the nginx mailing list