#47396 closed enhancement (fixed)
Cron: Add no cache headers before calling `fastcgi_finish_request()`
Reported by: | peterwilsoncc | Owned by: | |
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Cron API | Keywords: | good-first-bug has-patch |
Focuses: | Cc: |
Description
Calls to wp-cron.php
are not intended to be cached.
In the block checking for and running fastcgi_finish_request()
adding headers to prevent caching will prevent the DefaultTTL from being used on CDNs such as CloudFlare.
Expires: Wed, 11 Jan 1984 05:00:00 GMT Cache-Control: no-cache, must-revalidate, max-age=0
Attachments (3)
Change History (10)
#3
@
5 years ago
- Keywords needs-refresh added; needs-testing removed
@kingkero Thanks so much for the patch.
You've put the headers in the perfect spot, but it is OK if you use the Expires
and Cache-Control
headers I noted above?
WordPress has a function nocache_headers()
that uses the expires and cache-control headers. nocache_headers()
isn't available here but using the same two headers will ensure consistency for WordPress sites.
I've marked this patch as needing a refresh, if you have time that would be great but I (or another person) can pick it up if you don't.
#4
@
5 years ago
@peterwilsoncc You're very welcome.
I added a new diff with the headers from the wp_get_nocache_headers()
method and removed the Pragma
, since the other method doesn't set it either
added Cache-Control and Pragma header