nginx defined: in response to the request header and header

1) response header

add_header

E.g:

        add_header Cache-Control no-cache;
        add_header Access-Control-Allow-Origin *;
        add_header X-Proxy-Cache $upstream_cache_status;

 Be careful of Nginx add_header Detailed instructions:

When the current level is not add_header instruction will inherit the parent level settings. So my question would clear: location there add_header, nginx.conf configuration is discarded.

For example, you add a layer add_header information on location, the server also adds a layer add_header information,

So add_header server layer is discarded, so be careful to add

 

2) request header

proxy_set_header

E.g:

    proxy_set_header Accept-Encoding "";
    proxy_set_header Host $http_host;
    proxy_cookie_domain $host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

 

Guess you like

Origin www.cnblogs.com/faberbeta/p/nginx-configure002.html