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).
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).