H
H
HoHsi2015-09-28 21:14:38
Nginx
HoHsi, 2015-09-28 21:14:38

Why does NGINX remove global headers?

Why does the header from the static locale "location /public" remove the global header "X-Create-By". And how to avoid this without re-inserting this header in "public"?

server {
    listen       80;
    server_name  <тут урл>;

    access_log  <тут логи>;
    error_log  <тут логи>;

    add_header X-Create-By "HoHsi";

    # GZIP
    gzip on;
    gzip_disable "msie6";
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;

    location /public {
        # Срок годности
        # expires     1d;

        # <-- этот хэдер удалит "X-Create-By"
        add_header Cache-Control "max-age=10800000,  public";
        root <тут рут>;
    }

    location / {
        proxy_pass  <тут прокси>;
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Nikiforov, 2015-09-28
@eoffsock

add_headerwill apply to location{}only if location{}no other is defined in add_header.
Documentation:
nginx.org/en/docs/http/ngx_http_headers_module.htm...
Escape - nothing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question