Closed xtrasimplicity closed 4 years ago
Hey, @ronwsmith - apologies for the ping, but just wanted to see if this is something that you'd be open to, or if there's another way you'd prefer this be handled? Thanks!
@xtrasimplicity this change looks good to me. I'm thinking we need to soon change the variable names as it hurts my head thinking about this logic now :) May be a little over a week before I get this in.
@xtrasimplicity released in v2.3.0
Thanks, @ronwsmith!
Background
Currently, for a URL to be cacheable, it must have a cacheable HTTP response code and:
The problem with this is that sometimes you may want to force a whitelisted host to also be cacheable. For example, in one application I'm working on, I'd like to block all external requests using
c.non_whitelisted_requests_disabled
, but allow specific hosts to be cached so that I can use Puffing-Billy as I would VCR.Logically, when using
c.non_whitelisted_requests_disabled
only whitelisted requests are enabled. Unfortunately, however, whitelisted URLs are never cached, so I have two options: 1) Setc.non_whitelisted_requests_disabled
tofalse
and cache all requests, OR 2) Abandon my plan to use Puffing-billy as I would VCR, and just stub requests manually.Solution
cache_whitelist
config option which functions in the same way aswhitelist
.c.cache_whitelist
array.