<div dir="ltr">Hello,<br><div><br>nginx writes the rsponse from a proxy to disk. eg.<br>[...]<br>Server: nginx<br>Date: Mon, 11 Mar 2019 23:23:28 GMT<br>Content-Type: image/png<br>Content-Length: 45360<br>Connection: close<br>Expect-CT: max-age=0, report-uri="<a href="https://openstreetmap.report-uri.com/r/d/ct/reportOnly" target="_blank">https://openstreetmap.report-uri.com/r/d/ct/reportOnly</a>"<br>ETag: "314b65190a8968893c6c400f29b13369"<br>Cache-Control: max-age=126195<br>Expires: Wed, 13 Mar 2019 10:26:43 GMT<br>Access-Control-Allow-Origin: *<br>X-Cache: MISS from <a href="http://trogdor.openstreetmap.org" target="_blank">trogdor.openstreetmap.org</a><br>X-Cache-Lookup: HIT from <a href="http://trogdor.openstreetmap.org:3128" target="_blank">trogdor.openstreetmap.org:3128</a><br>Via: 1.1 <a href="http://trogdor.openstreetmap.org:3128" target="_blank">trogdor.openstreetmap.org:3128</a> (squid/2.7.STABLE9)<br>Set-Cookie: qos_token=031042; Max-Age=3600; Domain=<a href="http://openstreetmap.org" target="_blank">openstreetmap.org</a>; Path=/<br>Strict-Transport-Security: max-age=31536000; includeSubDomains; preload<br>[...]<br><br>is it possible to modify the Cache-Control and Expires header before the response is written to disk?<br><br>The config:<br><br>      location /tiles/ {<br>                proxy_http_version 1.1;<br>                proxy_ignore_headers "Cache-Control" "Expires" "Set-Cookie";<br>                proxy_cache_valid any 30d;<br><br>                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>                proxy_set_header X_FORWARDED_PROTO https;<br>                proxy_set_header Host $proxy_host;<br>                proxy_ssl_server_name on;<br>                proxy_ssl_name $proxy_host;<br>       <br>                proxy_ssl_certificate     /etc/nginx/cert.pem;<br>                proxy_ssl_certificate_key /etc/nginx/key.pem;<br><br>                expires 30d;<br>                proxy_cache_lock on;<br>                proxy_cache_valid  200 302  30d;<br>                proxy_cache_valid  404      1m;<br>                proxy_cache_key "$request_uri";<br>                proxy_redirect off;<br>                proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;<br>                add_header X-Cache-Status $upstream_cache_status;<br> <br>                # add_header Cache-Control public;<br>                add_header Last-Modified "";<br>                add_header ETag "";<br> <br>                proxy_cache tiles;<br>                proxy_pass <a href="https://openstreetmap_backend/" target="_blank">https://openstreetmap_backend/</a>;<br>        }<br><br>The problem is: the cached tiles on disk do not have "Cache-Control: max-age=2592000" but "Cache-Control: max-age=126195" regardless of setting proxy_ignore_headers "Cache-Control".<br><div>I assumed that setting proxy_ignore_headers "Cache-Control"; and "expires 30d;" will remove the header from the response and write the corresponding "Cache-Control" and "Expires" with the 30d.</div><div><br></div><div><br></div><div>Or do I have to do this:</div><div><br></div><div>browser -></div><div>nginx, caches and if necessary requests new tile via -></div><div>nginx, sets expires: 30d; calls tileserver</div><div><br></div><div>Kind regards,</div><div>Manuel</div><div><br></div></div></div>