admin管理员组文章数量:1335361
As developer, you want all the time the last version files on page refresh action. As I understood, there are 3 kinds of cache :
- Browser cache (Browser settings)
- Website cache (WP plugins)
- Proxy cache (HTTP Headers)
For some reasons, there are some days where I can removed browser cache, download a new browser on Wordpress project without any cache plugin... If I keypress F5, CTRL+F5 or CTRL+Shift+R, I got an old version, sometimes version older. I can loose hours like this. One friend told me to see about the proxy cache and force the HTTP Header to get the last files version.
I got this raw header :
GET /preprod/sign-up/ HTTP/2
Host: mysite
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: ...
DNT: 1
Connection: keep-alive
Cookie: wordpress_test_cookie=WP+Cookie+check; bid_1_password_protected_auth=1111111111111111111111; SERVERID123456=1234
Upgrade-Insecure-Requests: 1
Pragma: no-cache
Cache-Control: no-cache
Questions :
- How can I check if it can be a proxy cache matter ?
- How can I resolve that in this case on a Wordpress site ?
As developer, you want all the time the last version files on page refresh action. As I understood, there are 3 kinds of cache :
- Browser cache (Browser settings)
- Website cache (WP plugins)
- Proxy cache (HTTP Headers)
For some reasons, there are some days where I can removed browser cache, download a new browser on Wordpress project without any cache plugin... If I keypress F5, CTRL+F5 or CTRL+Shift+R, I got an old version, sometimes version older. I can loose hours like this. One friend told me to see about the proxy cache and force the HTTP Header to get the last files version.
I got this raw header :
GET /preprod/sign-up/ HTTP/2
Host: mysite
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: ...
DNT: 1
Connection: keep-alive
Cookie: wordpress_test_cookie=WP+Cookie+check; bid_1_password_protected_auth=1111111111111111111111; SERVERID123456=1234
Upgrade-Insecure-Requests: 1
Pragma: no-cache
Cache-Control: no-cache
Questions :
- How can I check if it can be a proxy cache matter ?
- How can I resolve that in this case on a Wordpress site ?
- Keep in mind that hosting issues, and 3rd party plugin support, are both offtopic here, and there is little that can be done in the generic sense. You've bought into various plugins and technologies that have solutions and expertise unique to those plugins and technologies. You would get more useful answers at their support routes and in their community forums/groups than on a general WP Q&A site or forum – Tom J Nowell ♦ Commented Jul 20, 2020 at 18:16
2 Answers
Reset to default 2If it's browser cache, you can go into the dev tools and disable all local cache. Browser docs can tell you how to do this.
If it's the proxy cache, either turn it off or load the site without the proxy, and retest. You will need to consult the documentation for the proxy you're using for how to do this, and how to fix it. You would be better asking on another stack about your specific proxy software and its configuration.
If it's the WP cache, then no, WP doesn't have a page cache. Either disable the plugins providing caching and retest, or consult with their documentation. The solution here will be plugin specific, there is no generic WP solution as there is noo generic WP page caching.
Either start with browser cache and work by peeling away the layers in a process of elimination. Or, by eliminating all of it, and turning it back on 1 layer at a time until the misbehaviour returns. This will give you useful information on how to debug the problem and which layer is problematic.
I found a solution here.
function add_header_no_cache($headers) {
$headers['Cache-Control'] = 'no-cache, no-store, must-revalidate, max-age=0';
$headers['Pragma'] = 'no-cache';
$headers['Expires'] = '0';
return $headers;
}
add_filter( 'wp_headers', 'add_header_no_cache_login' );
本文标签: proxyHow to be sure to get last page version without ANY cache
版权声明:本文标题:proxy - How to be sure to get last page version without ANY cache? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742246645a2439972.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论