Cron API: Prevent caching of WP Cron requests.

Add `Cache-Control` and `Expires` HTTP headers to prevent caching of requests to WP Cron on systems supporting fastcgi_finish_request(). 

The fastcgi_finish_request() call prevents the setting of further HTTP headers by caching plugins subsequently loaded.

Props kingkero.
Fixes 47396.


Built from https://develop.svn.wordpress.org/trunk@45560


git-svn-id: http://core.svn.wordpress.org/trunk@45371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2019-06-22 11:13:51 +00:00
parent fdb8ff4980
commit b0e82d2cc4
2 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,8 @@ ignore_user_abort( true );
/* Don't make the request block till we finish, if possible. */
if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
fastcgi_finish_request();
}

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45559';
$wp_version = '5.3-alpha-45560';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.