Howto Remove the Cache-Control request header.
Francis Daly
francis at daoine.org
Sun Jan 17 00:16:45 UTC 2021
On Sat, Jan 16, 2021 at 07:11:54PM +0100, Vincent Blondel wrote:
Hi there,
> We want nginx to remove the request header Cache-Control before to proxy
> the request to the OCS.
> We do like this ...
'proxy_set_header Cache-Control "";' appears to work for me.
Can you show one request to nginx with the header, and the matching
request to the upstream server?
When I use this config:
==
server {
listen 7000;
add_header X-7000 "cache :$http_cache_control:";
location /a {
proxy_set_header Cache-Control "";
proxy_pass http://127.0.0.1:7001;
}
location /b {
proxy_pass http://127.0.0.1:7001;
}
}
server {
listen 7001;
add_header X-7001 "cache :$http_cache_control:";
location / {
return 200 "7001: $request_uri\n";
}
}
==
if I make a request to port 7000 that starts with /b and includes a
Cache-Control header, I see in the X-7001 response header that that same
Cache-Control header was sent to the upstream; but if I make a request
that starts with /a, I see in the X-7001 response header that it was
removed before the request was made to the upstream.
That is:
curl -i -H Cache-control:no-cache http://127.0.0.1:7000/b1
includes
X-7001: cache :no-cache:
X-7000: cache :no-cache:
while
curl -i -H Cache-control:no-cache http://127.0.0.1:7000/a1
includes
X-7001: cache ::
X-7000: cache :no-cache:
Does your system respond differently?
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list