Answer the question
In order to leave comments, you need to log in
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
add_header
will 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 questionAsk a Question
731 491 924 answers to any question