Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Adding different headers for different requests

$
0
0
After some research I see that I cannot use if directive in http context, it can only be used on "lower" levels, so in server or location. However, if together with add_header can only be used in location context. So it's not perfectly flexible for me - in this scenario I can configure my headers the way I want (see example below), but would still need to manually include the config file in **every** location.

add_header xxx;

if ($uri ~* \.(png)$) {
add_header xyz;
}

I'd love to hear any ideas that would help me keep my header configuration within http context (best-case scenario) or server context (if http is not possible).

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>