Welcome! Log In Create A New Profile

Advanced

proxy_cache only if custom header is set by upstream

May 15, 2012 11:42AM
Hi,

i know how to *prevent* caching if custom headers are set by upstream with proxy_cache_bypass and proxy_no_cache.

This time i'd like to do the opposite, i want the response to be cached *only* if a custom header is present.

I tried something like:

set $nocache 1;

proxy_no_cache $nocache;

...

if ($upstream_http_myheader = 1) {

set $nocache 0;

}

But this doesn't work. Any ideas or am i missing something?

cheers

Thomas Lohner
Subject Author Posted

proxy_cache only if custom header is set by upstream

ThomasLohner May 15, 2012 11:42AM

Re: proxy_cache only if custom header is set by upstream

Maxim Dounin May 15, 2012 11:52AM

Re: proxy_cache only if custom header is set by upstream

Valentin V. Bartenev May 15, 2012 12:00PM

Re: proxy_cache only if custom header is set by upstream

ThomasLohner May 15, 2012 12:24PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 233
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready