Caching fastcgi url

Francis Daly francis at daoine.org
Tue Jun 23 22:39:18 UTC 2015


On Tue, Jun 23, 2015 at 06:27:30PM -0400, CJ Ess wrote:

Hi there,

> So looks like your saying the best way to do it is to do a separate
> location and duplicate the fastcgi setup in that location and add the
> fastcgi_cache stuff.

It strikes me as clearer to have one extra location{} than to have a
map{} or an if() to set a variable and then use fastcgi_no_cache and/or
fastcgi_cache_bypass with that variable.

But either way should work.

I'm not going to be the one trying to understand it in a year's time.

> I can work with that, however I came across this example while googling (
> https://gist.github.com/magnetikonline/10450786) that uses "if" to set a
> variable which I could use to match on the URL and trigger
> fastcgi_cache_bypass for everything not matching. Is "if" so toxic that I
> shouldn't consider doing it this way?

"if" seems fine for that, so long as it is not inside location{}.

I'd probably use "map", though, if I were going to do that.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list