• Resolved Alexander Guskov

    (@forcesail)


    I have noted that sometimes some pages that are in the list “URLs to exclude from caching” comes from browser cache (Chrome 109).

    I spent a few days to investigate the problem and found:
    1) When WPO is deactivated all comes (to pages) from wp_include/function.php (wp_get_nocache_headers)
    Cache-Control: no-cache, must-revalidate, max-age=0
    Expires: Wed, 11 Jan 1984 05:00:00 GMT

    That is neutral to caching (no cache but is not secure from storing some cache is browser)

    2) When WPO is just activated but any caching is off it adds cache-control: private, must-revalidate to .htaccess file (it seams that mod_headers.c replace only the records that have been added by it) and since that all pages have 2 cache-control records in their headers (another cache-control: no-cache, must-revalidate, max-age=0 comes from WP core (see #1)), that according to Apache documentation “can lead to unforeseen consequences”(https://httpd.apache.org/docs/2.4/mod/mod_headers.html#header)
    So, when WPO is just activated it already create the problem!

    3) When WPO is active and caching it adds cache-control: no-cache that replace that one, that comes from WP core (see #1) but with that one, that comes from .htaccess are still creates 2 cache-control records in header.

    4) But the real problem happens with pages that marked to be excluded from caching. Including them in the list “URLs to exclude from caching” we clear understand that we are doing our best to avoid them to be cached. So we expect to find in the header something like:
    cache-control: no-cache, no-store, max-age=0
    and no expires record
    But there are:
    cache-control: private, must-revalidate (comes from .htaccess file (see #2)
    expares: in future

    It means that such pages are stored by browser and can be shown later and even to someone else.

    It definitely should be added “no-store” to Cache-Control (as well as no-cache, max-age=0 and expires should be removed for such “exclude from cache” pages to prevent known leak of security (one of them described by chrome team here: https://github.com/fergald/explainer-bfcache-ccns/blob/main/README.md )

    I know that the question either use “no-store” or not is discussable and on https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching baselessly climes not to use it, but all real browser use it as it assumed can be used
    https://web.dev/http-cache/#cache-control

    5) A bit more errors with “URLs to exclude from caching”:
    I input there:
    =========
    /tests/*
    /yandexinfo.php
    /regsem/*
    ========
    where /regsem/ is a page and it doesn’t cache,
    /yandexinfo.php is a page and it doesn’t cache,
    BUT /tests/* is the 1st level of structure and it caches (but the next levels are not.
    https://forcesail.ru/tests/ (cached)
    https://forcesail.ru/tests/basic-movements/ (not cached)

    6) It’s probably incorrect that you WPO ignores nocache_headers WP core hook to synchronize header’s recording with WP and other plugin and adds headers directly. I haven’t investigated that it comes to any errors now but it’s breaking of structure and is a posible way to serious problems in any future.

Viewing 10 replies - 16 through 25 (of 25 total)
  • Thread Starter Alexander Guskov

    (@forcesail)

    I did exactly that you instructed to do and that I listed above. All other that you see on video is just demonstrations the content (.htaccess and other).

    I definitely did NOT do anything else. So, the experiment was absolutely clean.

    All the manipulation with .htaccess were out of our experiment (before, when I created the table a days ago).

    Plugin Support vupdraft

    (@vupdraft)

    Hi Alexander,

    We are looking at this, we will get back to your shortly.

    Plugin Support vupdraft

    (@vupdraft)

    
    
    We are having a hard time understanding the full picture of what you did and what you didn't do (the video doesn't help much). For example, did you modify the .htaccess file? If so, we expect you to mention it in the reproduction steps, along with screenshots of the modifications you made.
    
    To bring more clarity to the situation, let's start from the beginning. Please provide us with the reproduction steps for #5 using the following format (it is important that you follow this format):
    
    == How to reproduce the issue ==
    
    1. Go to X page
    
    2. Click on Y button, screenshot: https://example.com/screenshot.png
    
    3. Enter Z in the input field
    
    4. You will see A, screenshot: https://example.com/screenshot.png
    
    == Expected result ==
    
    In step 4, I expect to see B, screenshot: https://example.com/screenshot.png
    
    Here's an example:?https://prnt.sc/m5B4xGNc3JOi
    
    Let us know if you have any questions.
    Thread Starter Alexander Guskov

    (@forcesail)

    Hi,
    as I wrote above (I hope you read me very carefully):
    I ONLY did exactly that you instructed to do and that I listed above ONLY. I definitely did NOT do anything else.

    So, I did NOT do anything with .htaccess!!!!!!!!!!!

    Please, ask you technical team to stop dreaming on my actions and read me carefully, please. I believe that I described clear enough the huge investigation work that I had done for your team.

    I believe that the issueES lay on top and can be reproduced without any difficulties.

    Plugin Support vupdraft

    (@vupdraft)

    Hi Alexander,

    I am just checking this with the development team

    Plugin Contributor Venkat Raj

    (@webulous)

    Hi @forcesail

    I followed the same steps you’ve demonstrated in your video and I couldn’t able to reproduce the issue. Please watch the video and let me know where I went wrong.

    https://drive.google.com/file/d/1aVvGK1ovDPvN9eUd1ueROrYr_j0HdAZv/view?usp=drive_link

    In my testing, there is no cache-control header by default in WordPress. As per the apache documentation
    https://httpd.apache.org/docs/2.4/mod/mod_headers.html#header

    Only using add causes 2 or more headers with the same name. Whereas WP-O uses set in its .htaccess rules.

    If this is browser specific or server specific (i.e. specific version of module header, rewrite) then I’m afraid I couldn’t do much to help you.

    You could disable browser caching in WP-Optimize and setup your own rules in your server to solve the issue?

    Thread Starter Alexander Guskov

    (@forcesail)

    Hello Venkat Raj,

    the difference is in Incognito mode: you do in unloged-in.
    1) WP adds headers for logged in users
    2) WPO adds headers:
    – for “Browser static file caching settings”
    – when minifying is on
    – when cached
    2) Apache doesn’t join same named headers from PHP and from mod_headers (it seems to be an error in Apache 2.4). Some other servers do.

    See 2 screenshots:
    1) unlogged: https://forcesail.ru/Cache-Control/not-logged.jpg
    2) logged-in: https://forcesail.ru/Cache-Control/logged-in.jpg

    Plugin Contributor Venkat Raj

    (@webulous)

    Hello Alexander,

    Here is logged in version of the same steps.
    https://drive.google.com/file/d/1mKcxfLJQnDZrKC8P5NEjasd_vtLgIr3X/view?usp=drive_link

    It is also from Apache 2.4 as you can see in screencast.

    Minify only overwrite the value on static assets, doesn’t send separate headers
    https://plugins.trac.www.ads-software.com/browser/wp-optimize/tags/3.2.16/minify/class-wp-optimize-minify-front-end.php#L2115

    Since this seems to be a specific environment issue, I’m afraid I couldn’t help much.

    I agree with one thing that If an URL is excluded then browser cache shouldn’t send caching headers for that page. I’ve added this to our to do list.



    Thread Starter Alexander Guskov

    (@forcesail)

    Hello Venkat,

    unfortunately I have to report you that it’s quite common problem with Apache server.

    I have passed through your support request list and, although the most of requesters don’t use WPO any more I have found a few websites with the same problem: duplicate Cache-Control header. For example this one: https://petrbarvik.cz/

    Another thing is that is issue is known and disputed in internet:
    https://www.google.co.uk/search?&q=mod_headers+sends+duplicate+headers

    So, the only reason is to avoid use mod_headers at all.

    Please, indicate will and when will have you fixed the issues that I have reported you recently or you advice to avoid to use WPO as it will keep breaking sites (I mean all issues that I have reported recently, especially that one that connects with WPTouch).

    Plugin Support vupdraft

    (@vupdraft)

    Hi,

    We have created an internal ticket for the fix. Unfortunately we cannot offer a time frame for this. My advice would be to keep an eye on the changelog.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘cache-control mess in the headers and posible leak of secure’ is closed to new replies.