Fixed proxy/browser caching issues in admin pages

This commit is contained in:
Matias Griese
2020-09-14 13:46:59 +03:00
parent af314f789d
commit 8b6679855c
29 changed files with 39 additions and 3 deletions

View File

@@ -2,7 +2,8 @@
## mm/dd/2020 ## mm/dd/2020
1. [](#bugfix) 1. [](#bugfix)
* Fixed issue that would force a page reload when failing to install/update a plugin or theme. * Fixed issue that would force a page reload when failing to install/update a plugin or theme
* Fixed proxy/browser caching issues in admin pages
# v1.9.16 # v1.9.16
## 09/01/2020 ## 09/01/2020

View File

@@ -451,6 +451,8 @@ class AdminPlugin extends Plugin
// Replace page service with admin. // Replace page service with admin.
$this->grav['page'] = function () use ($self) { $this->grav['page'] = function () use ($self) {
$page = new Page(); $page = new Page();
// Plugins may not have the correct Cache-Control header set, force no-store for the proxies.
$page->expires(0); $page->expires(0);
if ($this->grav['user']->authorize('admin.login')) { if ($this->grav['user']->authorize('admin.login')) {
@@ -467,6 +469,7 @@ class AdminPlugin extends Plugin
if (file_exists(__DIR__ . "/pages/admin/{$self->template}.md")) { if (file_exists(__DIR__ . "/pages/admin/{$self->template}.md")) {
$page->init(new \SplFileInfo(__DIR__ . "/pages/admin/{$self->template}.md")); $page->init(new \SplFileInfo(__DIR__ . "/pages/admin/{$self->template}.md"));
$page->slug(basename($self->template)); $page->slug(basename($self->template));
return $page; return $page;
} }

View File

@@ -1,6 +1,7 @@
--- ---
title: Generic Ajax title: Generic Ajax
template: default template: default
expires: 0
access: access:
admin.login: true admin.login: true

View File

@@ -1,6 +1,7 @@
--- ---
title: Backup title: Backup
template: default template: default
expires: 0
access: access:
admin.maintenance: true admin.maintenance: true

View File

@@ -1,6 +1,7 @@
--- ---
title: Cache title: Cache
template: default template: default
expires: 0
access: access:
admin.cache: true admin.cache: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Config title: Config
expires: 0
access: access:
admin.configuration: true admin.configuration: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Dashboard title: Dashboard
expires: 0
access: access:
admin.login: true admin.login: true

View File

@@ -1,4 +1,5 @@
--- ---
title: Access Denied title: Access Denied
expires: 0
--- ---

View File

@@ -4,6 +4,7 @@ robots: noindex,nofollow
template: error template: error
routable: false routable: false
http_response_code: 404 http_response_code: 404
expires: 0
--- ---
Woops! Looks like this page doesn't exist. Woops! Looks like this page doesn't exist.

View File

@@ -1,6 +1,7 @@
--- ---
title: News Feed title: News Feed
template: ajax template: ajax
expires: 0
access: access:
admin.login: true admin.login: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Forgot password title: Forgot password
expires: 0
form: form:
fields: fields:

View File

@@ -1,6 +1,8 @@
--- ---
title: PHP Info title: PHP Info
template: config template: config
expires: 0
access: access:
admin.settings: true admin.settings: true
admin.super: true admin.super: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Installer title: Installer
expires: 0
access: access:
admin.install: true admin.install: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Admin Login title: Admin Login
expires: 0
forms: forms:
login: login:
@@ -13,7 +14,7 @@ forms:
autofocus: true autofocus: true
validate: validate:
required: true required: true
password: password:
type: password type: password
placeholder: PLUGIN_ADMIN.PASSWORD placeholder: PLUGIN_ADMIN.PASSWORD
@@ -33,5 +34,5 @@ forms:
type: text type: text
id: twofa-code id: twofa-code
autofocus: true autofocus: true
placeholder: PLUGIN_ADMIN.2FA_CODE_INPUT placeholder: PLUGIN_ADMIN.2FA_CODE_INPUT
--- ---

View File

@@ -1,6 +1,7 @@
--- ---
title: Media title: Media
template: default template: default
expires: 0
access: access:
admin.pages: true admin.pages: true

View File

@@ -1,6 +1,7 @@
--- ---
title: Notifications title: Notifications
template: default template: default
expires: 0
access: access:
admin.login: true admin.login: true

View File

@@ -1,6 +1,7 @@
--- ---
title: Pages Filter title: Pages Filter
template: default template: default
expires: 0
access: access:
admin.pages: true admin.pages: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Pages title: Pages
expires: 0
access: access:
admin.pages: true admin.pages: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Plugins title: Plugins
expires: 0
access: access:
admin.plugins: true admin.plugins: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Preview title: Preview
expires: 0
access: access:
admin.pages: true admin.pages: true

View File

@@ -1,4 +1,6 @@
--- ---
expires: 0
form: form:
fields: fields:
- name: username - name: username

View File

@@ -1,5 +1,6 @@
--- ---
title: Reset password title: Reset password
expires: 0
form: form:
fields: fields:

View File

@@ -1,6 +1,8 @@
--- ---
title: Site Settings title: Site Settings
template: config template: config
expires: 0
access: access:
admin.settings: true admin.settings: true
admin.super: true admin.super: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Statistics title: Statistics
expires: 0
access: access:
admin.statistics: true admin.statistics: true

View File

@@ -1,6 +1,8 @@
--- ---
title: Configuration title: Configuration
template: config template: config
expires: 0
access: access:
admin.configuration: true admin.configuration: true
admin.super: true admin.super: true

View File

@@ -1,5 +1,6 @@
--- ---
title: Grav Themes title: Grav Themes
expires: 0
access: access:
admin.themes: true admin.themes: true

View File

@@ -1,5 +1,7 @@
--- ---
title: Grav Tools title: Grav Tools
expires: 0
access: access:
admin.login: true admin.login: true
--- ---

View File

@@ -1,6 +1,7 @@
--- ---
title: Updates title: Updates
template: default template: default
expires: 0
access: access:
admin.maintenance: true admin.maintenance: true

View File

@@ -1,5 +1,6 @@
--- ---
title: User title: User
expires: 0
access: access:
admin.users: true admin.users: true