Open rosamillan opened 1 year ago
A quick fix is to add the referrer to that action. For that we can add the following logic to the renderer:
if ( ! empty( $_SERVER['REQUEST_URI'] ) ) {
$referer = filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ), FILTER_SANITIZE_URL );
$referer = '&_wp_http_referer=' . rawurlencode( remove_query_arg( 'fl_builder', $referer ) );
} else {
$referer = '';
}
$url = admin_url( 'admin-post.php?action=' . $action );
$url .= $referer;
Effort XS
I have a case in which the exact same issue is happening for the "Clear this cache" button in the page list:
Adding the "&_wp_http_referer=%2Fwp-admin%2F" to the URL works fine for me.
Case related: https://secure.helpscout.net/conversation/2461303037/465232/ WP Rocket version: 3.15.7
https://secure.helpscout.net/conversation/2523194404/477364 https://beddenspeciaalzaakhendriksen.nl
It looks like I have a case related to this issue but in reverse. In the initial case for this issue, cache clear attempts result in white page due to the "Referrer-Policy: no-referrer"
header. In that case, the clear cache link did not include _wp_http_referer=%2Fwp-admin%2Foptions-general.php%3Fpage%3Dwprocket
.
However, in my ticket above, the "Referrer-Policy: strict-origin-when-cross-origin"
header is set, and the link also does contain the _wp_http_referer=%2Fwp-admin%2Fplugins.php
param, but I get a white screen when clearing cache.
If I remove the _wp_http_referer
param from the clear cache link, then clearing the cache does work:
https://secure.helpscout.net/conversation/2523194404/477364/#thread-7575853068
Related case: White screen when Clear Cache is clicked from Single Edit Post Sidebar:
https://secure.helpscout.net/conversation/2736897712/518288?folderId=8127831
Before submitting an issue please check that you’ve completed the following steps:
Describe the bug white screen appears after clicking the "clear cache button"- in the dashboard. The error appears when the header is "Referrer-Policy: no-referrer"
To Reproduce Steps to reproduce the behavior: For the error to appear, the header "Referrer-Policy: no-referrer" must be present
Expected behavior
Screenshots
Video provided by lucy (awesome debugging job): https://jumpshare.com/j/5QPVMsRAH2ChG0kT12dQ
Additional context This bug was tested in WPR version 3.12.4 and 3.12.5.1 The issue is resolved when you change the header to: Referrer-Policy: strict-origin-when-cross-origin
Alfonso noticed:
From the toolbar works ok.
Works ok: Clear cache from top menu https://www.domain.com/wp-admin/admin-post.php?action=purge_cache&type=all&_wp_http_referer=%2Fwp-admin%2Foptions-general.php%3Fpage%3Dwprocket&_wpnonce=d4eee5fa26
The only difference found it's the top menu link containing the _wp_http_referer and dashboard button no.
Backlog Grooming (for WP Media dev team use only)