• Hi,

    For some reason I can’t make CF do anything else than BYPASS or MISS.
    I have only 1 page rule that says:
    https://www.domain.com/*
    Cache Level: Cache Everything

    Full header response is:
    ====

    Request URL: https://www.domain.com/
    Request Method: GET
    Status Code: 200 
    Remote Address: 104.21.22.67:443
    Referrer Policy: strict-origin-when-cross-origin
    alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400, h3-28=":443"; ma=86400, h3-27=":443"; ma=86400
    cf-cache-status: BYPASS
    cf-ray: 6911ac135daf67c6-MIA
    content-encoding: br
    content-security-policy: block-all-mixed-content; upgrade-insecure-requests
    content-type: text/html; charset=UTF-8
    date: Sun, 19 Sep 2021 09:08:55 GMT
    expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    link: <https://www.domain.com/>; rel=shortlink
    nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
    referrer-policy: strict-origin-when-cross-origin
    report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=xL%2BbRbNdC%2BEocMDWIdrizqZtYGXiPypSAwg9GwCZ8pk%2BytN9E4eayYr%2BlboRCl3H5xjjaO1%2Fq4jkFAXUZvrvp8WHyfl5i%2FOBFpaG02jOT9zXDdoH%2FHyyQyvFVpNapi44xf%2FeVg%3D%3D"}],"group":"cf-nel","max_age":604800}
    server: cloudflare
    set-cookie: BqBAu=1; expires=Sun, 19-Sep-2021 12:08:55 GMT; Max-Age=10800
    strict-transport-security: max-age=15552000
    vary: Accept-Encoding
    x-content-type-options: nosniff
    x-frame-options: SAMEORIGIN
    x-wp-cf-super-cache: disabled
    x-wp-cf-super-cache-cache-control: no-store, no-cache, must-revalidate, max-age=0
    x-xss-protection: 1; mode=block
    :authority: www.stepmiles.com
    :method: GET
    :path: /
    :scheme: https
    accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
    accept-encoding: gzip, deflate, br
    accept-language: en-US,en;q=0.9,fr;q=0.8
    cache-control: max-age=0
    cookie: BqBAu=1; _ga=GA1.2.2058658285.1632041190; _gid=GA1.2.2102712705.1632041190; _fbp=fb.1.1632041190055.808570041
    referer: https://www.domain.com/services/
    sec-fetch-dest: document
    sec-fetch-mode: navigate
    sec-fetch-site: same-origin
    sec-fetch-user: ?1
    sec-gpc: 1
    upgrade-insecure-requests: 1
    user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36

    ====

    Any idea on how to fix this?

    • This topic was modified 3 years, 2 months ago by Jan Dembowski.

    The page I need help with: [log in to see the link]

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter msstm

    (@msstm)

    I was able to get HIT by adding to my page rules Edge Cache TTL.
    My performances don’t seem to improve (Lighthouse at least):
    1. What is the best Edge cache TTL timings? 4 hours, a day?
    2. I still can’t get an Efficient Cache policy that works, especially for woff2. Is there a setting or .htaccess rule that I should be adding?

    Thanks

    Plugin Contributor iSaumya

    (@isaumya)

    First of all, your page rule is showing as https:// instead of https://. So, please check that.

    Also your cache-control: max-age=0 is being set by either some other plugin or some server level rule. Please remove that as the cache control needs to be managed by this plugin only.

    Moreover, you have not shared your website URL so I can’t check the live site. But never ever set the edge cache TTL by yourself. Inside the CF dashboard > Caching > Configuration > Browser Cache TTL should be set to Respect Header and no page rule should modify it.

    Please consider sharing your actual site URL so that I can check it on my end.

    Thread Starter msstm

    (@msstm)

    Hi Saumya,

    Thanks for the response.

    1. Page rule:
    It is including https as you can see https://ibb.co/5xMH2wG

    2. Cache control:
    I don’t know where it was coming from, now it shows “cache-control: s-maxage=31536000, max-age=60”

    3. Edge caching:
    If I remove this rule, then I always get BYPASS instead of HIT and I really don’t know why at all.
    What are the downsides of setting Edge caching TTL as rule?
    My browser cache TTL is set to respect existing headers too.

    Maybe one of the following .htaccess rules interferes?

    <IfModule mod_expires.c>
    ExpiresActive On
    # Images
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"
    # Video
    ExpiresByType video/mp4 "access plus 1 year"
    ExpiresByType video/mpeg "access plus 1 year"
    # CSS, JavaScript
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    # Others
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    # Add a far future Expires header for fonts
    ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
    ExpiresByType application/x-font-ttf "access plus 1 year"
    ExpiresByType application/x-font-opentype "access plus 1 year"
    ExpiresByType application/x-font-woff "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    #ExpiresDefault "access 2 days"
    </IfModule>

    I know that I’m not sharing the link so I’m not making it easy but I prefer not to share publicly for now.

    • This reply was modified 3 years, 2 months ago by msstm.
    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    first of all, as you have not shared any link, I can’t check the site on my end. That being said, the htacces rule you have provided above is for static file caching. But you don’t need those rules as those are very old rules and not needed.

    Instead, I would suggest you to remove those rules from your htaccess file and instead inside the plugin settings under the cache tab you will see an option to “Add browser caching rules for static assets”. You should enable that option. When you enable that option the plugin will add proper htaccess rules by itself which is modern and help your static files get properly cached at the Cloudflare CDN level as well as at the browser level.

    Using edge caching TTL within the rule is very dangerous as when you have that in your rule, it will take precedence over what the plugin and headers are asking Cloudflare to do resulting in bad cache behavior.

    Thread Starter msstm

    (@msstm)

    Hi,

    Thanks for the response.

    I removed all mod_expire rules and enabled “Add browser caching rules for static assets”.

    I am still getting cf-cache-status: BYPASS and can’t figure out where it is coming from at all.

    Thanks

    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    Please share your site URL it is impossible to check the matter like this

    Thread Starter msstm

    (@msstm)

    Hello,

    One of the sites (3 with the same issue) is [ expanded and in the link field ]
    Thanks again for trying to help.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @msstm Please do not use shortlinks in these forums. Those are expanded when found and I expanded yours into the link field.

    The link field is only viewable to users logged into the forums and is not scraped by any search engine.

    Thread Starter msstm

    (@msstm)

    I didn’t know that. Thanks for the info.

    • This reply was modified 3 years, 2 months ago by msstm.
    • This reply was modified 3 years, 2 months ago by msstm.
    Plugin Contributor iSaumya

    (@isaumya)

    Hi @msstm,
    Please share one of your site link where I can see this issue happening so that I can dig deeper.

    Thread Starter msstm

    (@msstm)

    Hi @isaumya,

    One of the sites is https://www.stepmiles.com.

    Thank you!

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @msstm,
    While checking your site I saw that your initial request (i.e. is the text/html one) is getting bypassed: https://i.imgur.com/nleiZ65.jpeg and the reason behind that is there is custom cookies being set on the page: https://i.imgur.com/SIq2PIq.jpeg

    Anytime Cloudflare server sees a page that has custom cookies in it, it Bypass cache for that page thinking that the Cookie value might be used inside the page to show dynamic content.

    The custom cookie is present even in pages about About is: https://i.imgur.com/nf0OJzs.jpeg
    Privacy Policy page: https://i.imgur.com/djVQw6V.jpeg

    you need to figure out what is adding the custom cookie and remove the plugin that is adding the custom cookie.

    Also inside the Cloudflare page rule section check if you have any special page rule added to bypass cache for the front page.

    Once you remove the plugin that is adding this custom cookie on your site, your cache should work perfectly.

    Thread Starter msstm

    (@msstm)

    Hi @isaumya,

    You were absolutely right, this cookie was the issue.
    I found out what plugin was generating it and disabled it and now I finally get a HIT.

    Now I’ll need to figure out why only the homepage gets a HIT while my CF rule to cache everything specifies https://www.example.com/*. It’s the only rule I have.

    And also now my images, css and js seem to get a MISS or EXPIRED instead of a HIT.

    Thanks for your help.

    • This reply was modified 3 years, 2 months ago by msstm.
    • This reply was modified 3 years, 2 months ago by msstm.
    • This reply was modified 3 years, 2 months ago by msstm.
    • This reply was modified 3 years, 2 months ago by msstm.
    Plugin Contributor iSaumya

    (@isaumya)

    Hi,
    As I can see your home page is properly getting cached by Cloudflare. Also your static files are properly getting cached.

    Now coming to why your other pages are showing DYNAMIC, please share screenshot of the Cloudflare page rule section and also inside the CF dashboard > Caching > Configuration make sure the Browser Cache TTL is set to Respect Header.

    P.S. Under Cacheing > Tiered Caching you should enable smart tiered caching as Cloudflare has made that free now.
    Read:
    https://blog.cloudflare.com/early-hints/
    https://blog.cloudflare.com/orpheus/
    https://blog.cloudflare.com/automatic-signed-exchanges/

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Bypass cache status’ is closed to new replies.