Skip to content

Conversation

@westonruter
Copy link
Contributor

Originally PR #13.

Useful for Squid and other proxies to allow stale content to be served if the server has an error:

The stale-if-error HTTP Cache-Control extension improves availability
of some kinds of cached content by allowing servers and clients to
instruct caches to use stale responses when certain error conditions
are encountered.

See The stale-if-error HTTP Cache-Control Extension.

@vnsavage
Copy link
Contributor

Thanks! I have two suggestions on this:

  1. The new configurable comment says "If not zero, will set stale-if-error extension for Cache-Control (e.g. for Squid)", which is a mismatch with the actual check: ( $this->stale_if_error > 0 ); We should probably take a true/false approach.

  2. In order to make it cleaner and reduce code duplication, I propose that we use a add_cache_control_headers() function, which:
    a) Returns if $this->cache_control is not enabled.
    b) Returns if Last-Modified / Cache-Control headers are already set.
    c) Appends to $this->headers otherwise, which will afterwards be sent by do_headers()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants