mirror of
https://github.com/getgrav/grav.git
synced 2026-02-08 07:40:23 +01:00
added toggles to enable/disable last_modified and etag headers
This commit is contained in:
@@ -32,6 +32,8 @@ pages:
|
||||
'<': 'lt'
|
||||
types: 'txt|xml|html|json|rss|atom' # Pipe separated list of valid page types
|
||||
expires: 0 # Page expires time in seconds (604800 seconds = 7 days)
|
||||
last_modified: true # Set the last modified header
|
||||
etag: true # Set the expires header tag
|
||||
|
||||
cache:
|
||||
enabled: true # Set to true to enable caching
|
||||
|
||||
@@ -312,11 +312,15 @@ class Grav extends Container
|
||||
}
|
||||
|
||||
// Set the last modified time
|
||||
$last_modified_date = gmdate('D, d M Y H:i:s', $page->modified()) . ' GMT';
|
||||
header('Last-Modified: ' . $last_modified_date);
|
||||
if ($this['config']->get('system.pages.last_modified')) {
|
||||
$last_modified_date = gmdate('D, d M Y H:i:s', $page->modified()) . ' GMT';
|
||||
header('Last-Modified: ' . $last_modified_date);
|
||||
}
|
||||
|
||||
// Calculate a Hash based on the raw file
|
||||
header('ETag: ' . md5($page->raw().$page->modified()));
|
||||
if ($this['config']->get('system.pages.etag')) {
|
||||
header('ETag: ' . md5($page->raw() . $page->modified()));
|
||||
}
|
||||
|
||||
// Set debugger data in headers
|
||||
if (!($extension === null || $extension == 'html')) {
|
||||
|
||||
Reference in New Issue
Block a user