• Writing based on Ref: https://www.google.com/search?q=AMPFORWPLBROWSERCSTART

    # AMPFORWPLBROWSERCSTART Browser Caching
    <IfModule mod_expires.c>
    ExpiresActive On
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font-ttf .ttf
    AddType application/x-font-opentype .otf
    AddType application/x-font-woff .woff
    AddType image/svg+xml .svg
    ExpiresByType application/vnd.ms-fontobject "access 1 year"
    ExpiresByType application/x-font-ttf "access 1 year"
    ExpiresByType application/x-font-opentype "access 1 year"
    ExpiresByType application/x-font-woff "access 1 year"
    ExpiresByType image/svg+xml "access 1 year"
    ExpiresByType image/webp "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresByType text/css "access 3 month"
    ExpiresByType text/javascript "access 3 month"
    ExpiresByType text/html "access 3 month"
    ExpiresByType application/javascript "access 3 month"
    ExpiresByType application/x-javascript "access 3 month"
    ExpiresByType application/xhtml-xml "access 3 month"
    ExpiresByType application/pdf "access 3 month"
    ExpiresByType application/x-shockwave-flash "access 3 month"
    ExpiresDefault "access 3 month"
    </IfModule>
    # END Caching AMPFORWPLBROWSERCEND

    Concerning line

    ExpiresByType text/html "access 3 month"

    Why would someone set 3 month caching for HTML?

    Apart from that, this vagueness cannot be justified.
    ExpiresDefault "access 3 month"

    [ redundant link removed ]

    Thanks & Regards,
    Gulshan

    • This topic was modified 3 years, 11 months ago by Gulshan Kumar. Reason: added more details
    • This topic was modified 3 years, 7 months ago by Jan Dembowski.

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    We have created a GitHub ticket regarding the issue and it will be resolved in upcoming plugin updates.

    For reference please follow this GitHub ticket: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/4876

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    We have fixed this issue in recent plugin update
    version 1.0.73. Can you please update the plugin and check it once.

    Thread Starter Gulshan Kumar

    (@thegulshankumar)

    Status: Not fixed.

    When Leverage Browser Cache is enabled with default ’90’ days to expiration, I understand plugin should setting up caching policy for the static files only and never for text/html content.

    But it add…

    ExpiresByType text/html "access 3 month"

    … in following code block.

    # AMPFORWPLBROWSERCSTART Browser Caching
    <IfModule mod_expires.c>
    ExpiresActive On
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font-ttf .ttf
    AddType application/x-font-opentype .otf
    AddType application/x-font-woff .woff
    AddType image/svg+xml .svg
    ExpiresByType application/vnd.ms-fontobject "access 1 year"
    ExpiresByType application/x-font-ttf "access 1 year"
    ExpiresByType application/x-font-opentype "access 1 year"
    ExpiresByType application/x-font-woff "access 1 year"
    ExpiresByType image/svg+xml "access 1 year"
    ExpiresByType image/webp "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresByType text/css "access 3 month"
    ExpiresByType text/javascript "access 3 month"
    ExpiresByType text/html "access 3 month"
    ExpiresByType application/javascript "access 3 month"
    ExpiresByType application/x-javascript "access 3 month"
    ExpiresByType application/xhtml-xml "access 3 month"
    ExpiresByType application/pdf "access 3 month"
    ExpiresByType application/x-shockwave-flash "access 3 month"
    ExpiresDefault "access 3 month"
    </IfModule>
    # END Caching AMPFORWPLBROWSERCEND

    As a result, it output (https://i.imgur.com/rD4tbwy.png)

    Request URL: https://localhost/
    Request Method: GET
    Status Code: 200 OK
    Remote Address: [::1]:80
    Referrer Policy: strict-origin-when-cross-origin
    Cache-Control: max-age=7776000
    Connection: Keep-Alive
    Content-Type: text/html; charset=UTF-8
    Date: Wed, 30 Dec 2020 10:17:21 GMT
    Expires: Tue, 30 Mar 2021 10:17:21 GMT
    Keep-Alive: timeout=5, max=100
    Link: <https://localhost/wp-json/>; rel="https://api.w.org/"
    Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.4.13
    Transfer-Encoding: chunked
    X-Powered-By: PHP/7.4.13

    reload the page clicking logo

    Request URL: https://localhost/
    Request Method: GET
    Status Code: 200 OK (from disk cache)   <------ #Noticed?
    Remote Address: [::1]:80
    Referrer Policy: strict-origin-when-cross-origin
    Cache-Control: max-age=7776000
    Content-Type: text/html; charset=UTF-8
    Date: Wed, 30 Dec 2020 10:21:28 GMT
    Expires: Tue, 30 Mar 2021 10:21:28 GMT
    Link: <https://localhost/wp-json/>; rel="https://api.w.org/"
    Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.4.13
    X-Powered-By: PHP/7.4.13

    happening because Cache-Control: max-age=7776000 for text/html.

    What is expected?

    Cache-Control: max-age=0 for text/html via below code

    ExpiresByType text/html "access plus 0 seconds"

    or just avoid this entire mess by removing ExpiresByType text/html "access 3 month" and this one ExpiresDefault "access 3 month". After then only static files will have your user input (For example, 90) settings.

    — Error 500 —
    – Just keep enabled Leverage Browser Cache
    – Now, try changing the value like I have done
    https://youtu.be/3Ykz0SlkJTs

    [Wed Dec 30 16:02:20.647562 2020] [core:alert] [pid 760:tid 1840] [client ::1:63188] C:/xampp/htdocs/.htaccess: 'ExpiresByType text/css access 3 month days': bad expires code, numeric value expected <num> 'days', referer: https://localhost/wp-admin/options-permalink.php

    # AMPFORWPLBROWSERCSTART Browser Caching
    <IfModule mod_expires.c>
    ExpiresActive On
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-font-ttf .ttf
    AddType application/x-font-opentype .otf
    AddType application/x-font-woff .woff
    AddType image/svg+xml .svg
    ExpiresByType application/vnd.ms-fontobject "access 1 year"
    ExpiresByType application/x-font-ttf "access 1 year"
    ExpiresByType application/x-font-opentype "access 1 year"
    ExpiresByType application/x-font-woff "access 1 year"
    ExpiresByType image/svg+xml "access 1 year"
    ExpiresByType image/webp "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresByType text/css "access 3 month days"
    ExpiresByType text/javascript "access 3 month days"
    ExpiresByType text/html "access 3 month days"
    ExpiresByType application/javascript "access 3 month days"
    ExpiresByType application/x-javascript "access 3 month days"
    ExpiresByType application/xhtml-xml "access 3 month days"
    ExpiresByType application/pdf "access 3 month days"
    ExpiresByType application/x-shockwave-flash "access 3 month days"
    ExpiresDefault "access 3 month days"
    </IfModule>
    # END Caching AMPFORWPLBROWSERCEND

    Temp to fix, I modified
    Find 3 month days
    Replace to 3 month 0 days

    • This reply was modified 3 years, 10 months ago by Gulshan Kumar. Reason: added more details
    Thread Starter Gulshan Kumar

    (@thegulshankumar)

    I think Toggle for ‘Leverage browser caching’ should be removed entirely because this is not a page caching plugin. Most of the time, it is already taken care by Hosting server as appropriate.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    Okay, thanks for the info we will remove ExpiresByType text/html from our code and will push it in the next update, But why you are telling us to remove ExpiresDefault?

    • This reply was modified 3 years, 10 months ago by Ahmed Kaludi.
    • This reply was modified 3 years, 10 months ago by Ahmed Kaludi.
    Thread Starter Gulshan Kumar

    (@thegulshankumar)

    Sounds good to me. Thanks for considering my feedback.

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    why you are telling us to remove ExpiresDefault? Will you please elaborate more on that

    Thread Starter Gulshan Kumar

    (@thegulshankumar)

    Removing ExpiresDefault line ensure strictness in caching policy, prevents caching of unknown files.

    # A quick example
    <IfModule mod_expires.c>
    ExpiresActive On
    
    # Return Cache-Control: max-age=2592000 explicitly for CSS and JS 
    ExpiresByType text/css "access 1 month"
    ExpiresByType application/javascript "access 1 month"
    ExpiresByType text/javascript "access 1 month"
    
    # A rule for non-explicitly mentioned MIME type (Content-Type) files  
    # Return Cache-Control: max-age=120 
    # This may cover everything excluding CSS and JS as per this code block
    # Must avoid to unknowingly caching stuff that may affect UX or privacy
    # Also applies to proxy user who may have respect-existing header rule
    ExpiresDefault "access 120 seconds"
    </IfModule>
    # Example end
    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    We have re-opened the GitHub ticket and it will be resolved in upcoming plugin updates.

    For reference please follow this GitHub ticket: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/4876

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Browser Caching Policy’ is closed to new replies.