I have a single location block with many configurations, which acts as a proxy cache for multiple APIs. One of the APIs requires one additional config:
proxy_set_header Content-type "";
I can't seem to put an if statement anywhere and am aware that if statements. in general and especially in location blocks, are bad practice. Regardless, it's "not allowed" anywhere I've tried.
How can I add this additional config without creating a completely separate location block and cache just for this one API?
This is essentially what I want to get done:
location /cache/ {
proxy_http_version 1.1;
proxy_cache CACHE;
proxy_cache_valid 200 302 5m;
proxy_cache_key $host$uri;
proxy_cache_lock on;
proxy_set_header Connection "";
proxy_set_header Authorization '';
proxy_hide_header x-amz-meta-server-side-encryption;
proxy_hide_header x-amz-server-side-encryption;
proxy_hide_header Set-Cookie;
proxy_ignore_headers Set-Cookie Cache-Control;
if ($request_uri ~ /cache/device) {
proxy_set_header Content-Type "";
}
proxy_pass http://upstream;
}
(See the if statement.. i don't know why i cant bold that)
Thanks
Aucun commentaire:
Enregistrer un commentaire