• Resolved treimiller2018

    (@treimiller2018)


    We have enabled dynamic caching in the SG Optimizer plugin and purchased SiteGround Premium CDN and enabled dynamic caching there to help speed up our site.

    Here’s what I’m getting when I do a CURL command on the site.
    Server: nginx
    Date: Thu, 20 Oct 2022 15:20:02 GMT
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Vary: Accept-Encoding
    X-Cache-Enabled: True
    Link: <https://www.howtotrainadreamdog.com/wp-json/&gt;; rel=”https://api.w.org/&#8221;, <https://www.howtotrainadreamdog.com/wp-json/wp/v2/pages/209150&gt;; rel=”alternate”; type=”application/json”, <https://www.howtotrainadreamdog.com/&gt;; rel=shortlink
    Set-Cookie: wccp_pro_functionality=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
    Set-Cookie: socialsnap_viewed_209150=1; secure
    Cache-Control: private, must-revalidate
    Expires: Sat, 19 Nov 2022 15:19:53 GMT
    X-Httpd: 1
    X-CDN-C: all
    Content-Encoding: gzip
    X-SG-CDN: 1
    X-Proxy-Cache: MISS
    X-Proxy-Cache-Info: 0 NC:000000 UP:SKIP_CACHE_PRIVATE
    Host-Header: 8441280b0c35cbc1147f8ba998a563a7

    I have disabled each plugin and re-ran the CURL command, but the dynamic caching issue persists.

    I am using the exact same theme on other sites I support, and none of them have dynamic caching issues. So I’m stumped.

    Can anyone help me track down the source of this issue?`

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

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Simeon Boev

    (@k3llanved)

    Hello @treimiller2018,

    Our cache service will honor all cache control headers that are included in the request that is passed by either the application or via htaccess for example. In your particular case the Cache-Control: private header will prevent the page to be cached by our dynamic cache service. Cookies as well are not cached, thus any cookie that you set will prevent the page/request from being cached.

    Best Regards,
    Simeon Boev

    Thread Starter treimiller2018

    (@treimiller2018)

    Hello @k3llanved ,

    Not to sound stupid, but this is definitely outside my area of expertise and I still require assistance to resolve the source of the dynamic caching issue.

    I’ve found and removed the code from the htaccess file that was causing the Cache-Control:private header.

    From the CURL report, it looks like there are still two plug-ins that are setting cookies:

    Set-Cookie: wccp_pro_functionality=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/
    Set-Cookie: socialsnap_viewed_209150=1; secure

    Does this mean that these plug-ins are preventing dynamic caching from working altogether? Or is there some other cause that dynamic caching still isn’t working?

    Plugin Support Simeon Boev

    (@k3llanved)

    I confirm that we would not cache a page if a cookie is set by a plugin or via htaccess. Seek an alternative to the plugins that set those cookies if you intend to use our dynamic full-page cache.

    Best Regards,
    Simeon Boev

    Thread Starter treimiller2018

    (@treimiller2018)

    @k3llanved

    I have disabled the plugins that were creating cookies on the site (WP Content Copy Protection and Social Snap Plus), cleaned up the htaccess file, and dynamic caching is still not working per the CURL report below.

    All we have in the htaccess file is the SiteGround HTTPS enforce code and the standard WordPress htaccess file code.

    Server: nginx
    Date: Tue, 25 Oct 2022 15:57:51 GMT
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Vary: Accept-Encoding
    <strong>X-Cache-Enabled: True</strong>
    Link: <https://www.howtotrainadreamdog.com/wp-json/>; rel="https://api.w.org/", <https://www.howtotrainadreamdog.com/wp-json/wp/v2/pages/209150>; rel="alternate"; type="application/json", <https://www.howtotrainadreamdog.com/>; rel=shortlink
    X-Httpd: 1
    X-CDN-C: all
    Content-Encoding: gzip
    X-SG-CDN: 1
    <strong>X-Proxy-Cache: MISS</strong>
    X-Proxy-Cache-Info: 0 NC:000000 UP:
    Host-Header: 8441280b0c35cbc1147f8ba998a563a7
    Plugin Support Georgi Ganchev

    (@georgiganchev)

    Hello @treimiller2018,

    I have just tested your website and the CURL request is showing the status: HIT

    That means the page is properly utilizing Dynamic caching.

    HTTP/2 200 
    server: nginx
    date: Tue, 25 Oct 2022 16:10:20 GMT
    content-type: text/html; charset=UTF-8
    vary: Accept-Encoding
    x-cache-enabled: True
    link: <https://www.howtotrainadreamdog.com/wp-json/>; rel="https://api.w.org/", <https://www.howtotrainadreamdog.com/wp-json/wp/v2/pages/209150>; rel="alternate"; type="application/json", <https://www.howtotrainadreamdog.com/>; rel=shortlink
    x-httpd: 1
    x-cdn-c: all
    x-sg-cdn: 1
    x-proxy-cache: HIT
    host-header: 8441280b0c35cbc1147f8ba998a563a7

    The website is served over the CDN edge dynamic caching as well as seen from the results.

    You can also verify the page is properly cached by navigating to WordPress dashboard > SG Optimizer > Caching > Test URL Caching Status > click on Test.

    If you believe there is still a problem it would be best to post a Helpdesk request with the steps you take to receive that result and we try to assist you further.

    Best regards,
    Georgi Ganchev
    Technical Support
    SiteGround.com

    Thread Starter treimiller2018

    (@treimiller2018)

    Hi @georgiganchev

    I just retested the site and the first time I got a HIT as you did, but now I’m getting a MISS. So it seems to be alternating between HIT and MISS.

    Thread Starter treimiller2018

    (@treimiller2018)

    @georgiganchev

    Please hold off on checking the site again. It’s generating an error message so I need to restore it from backup and make the corrections again.

    Thread Starter treimiller2018

    (@treimiller2018)

    @georgiganchev

    Ok,you can check the site again now. The CURL report still shows a MISS on X-Proxy-Cache (see below), but when I check caching status through SG Optimizer > Caching > Test URL Status, I get a Success message.

    Server: nginx
    Date: Tue, 25 Oct 2022 17:01:48 GMT
    Content-Type: text/html; charset=UTF-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Vary: Accept-Encoding
    X-Cache-Enabled: True
    Link: <https://www.howtotrainadreamdog.com/wp-json/>; rel="https://api.w.org/", <https://www.howtotrainadreamdog.com/wp-json/wp/v2/pages/209150>; rel="alternate"; type="application/json", <https://www.howtotrainadreamdog.com/>; rel=shortlink
    X-Httpd: 1
    X-CDN-C: all
    Content-Encoding: gzip
    X-SG-CDN: 1
    X-Proxy-Cache: MISS
    X-Proxy-Cache-Info: 0 NC:000000 UP:
    Host-Header: 8441280b0c35cbc1147f8ba998a563a7
    Plugin Support Georgi Ganchev

    (@georgiganchev)

    @treimiller2018

    I am unable to replicate the reported issue. When the cache is flushed from the application the first CURL request would be MISS as there is no cache to load from.

    The second request would be HIT since the cache is loading.

    If you execute new CURL requests without purging the cache you will get x-proxy-cache: HIT

    If your issues still persist, please open a HelpDesk request. The SiteGround optimizer plugin is working properly.

    Best regards,
    Georgi Ganchev
    Technical Support
    SiteGround.com

    matth86

    (@matth86)

    Hola, tengo un problema similar, tengo cookies configuradas, por lo cual hay algun plugin que me genera un ciertas cabeceras que no dejan ejecutar la cache dinamica, tengo SiteGround, CDN y SG Optimizer, en las pruebas de SG dice que la web no esta en caché, a continuación el informe de SiteGround.
    Tu sitio tiene cookies configuradas y hay un encabezado de control de caché. Debido a esto, tu sitio web no tiene caché dinámica en este momento. Esto se ve en los encabezados al hacer una solicitud cURL, puedes ver un ejemplo a continuación, he marcado el encabezado de cookies y cache-control en negrita:

    Tsvetana-Georgieva:~ tsvetana.georgieva$ curl -I -X GET https://www.junkodecoracion.com HTTP/2 200 server: nginx date: Tue, 28 Mar 2023 12:30:20 GMT content-type: text/html; charset=UTF-8 vary: Accept-Encoding expires: Thu, 19 Nov 1981 08:52:00 GMT
    cache-control: no-cache
    pragma: no-cache x-cache-enabled: True link: https://www.junkodecoracion.com/wp-json/; rel=”https://api.w.org/&#8221;, https://www.junkodecoracion.com/wp-json/wp/v2/pages/143; rel=”alternate”; type=”application/json”, https://www.junkodecoracion.com/; rel=shortlink
    set-cookie: PHPSESSID=6e3556302bb1581fa5a325e79e5df60d; path=/; secure; HttpOnly
    x-httpd: 1
    x-cdn-c: all
    x-sg-cdn: 1
    x-proxy-cache: MISS
    x-proxy-cache-info: 0 NC:000000 UP:SKIP_CACHE_SET_COOKIE
    host-header: 8441280b0c35cbc1147f8ba998a563a7

    He comprobado si esto está definido en el archivo .htaccess, sin embargo, no había nada relevante allí. Esto significa que estos encabezados son añadidos por uno de tus plugins o tema. Puedes trabajar con tu desarrollador en términos de identificar qué plugin o si el tema agrega este encabezado y si esto es algo que se puede ajustar para que nuestra caché dinámica funcione en tu sitio.

    Plugin Support Simeon Boev

    (@k3llanved)

    Hello @matth86,

    Indeed our cache services will not cache requests that include cookies or cache-control: no-cache headers. Take a look at the configuration of the website in question and perform the necessary adjustments to remove both if you intend to use the dynamic cache at its full capacity.

    Best Regards,

    Simeon Boev

    matth86

    (@matth86)

    Hola Simeon Boev, he revisado todo y no he encontrado nada fuera de lo normal que haga que no pueda utilizar caché dinamico. Las configuraciones de SG tambien estan correctas, revisé el theme (porto) y no veo nada que tenga que modificar, tendrás alguna otra idea de donde puedo solucionar este problema?

    Muchas gracias!

    Plugin Support Dimo Dimov

    (@dimodi)

    Hello @matth86,

    Your website cannot be properly cached due to the fact that the application serves a cookie session in the response headers. This can be verified from the following line:

    set-cookie: PHPSESSID=6e2057c1b5007080845512275c7272b3;

    Sessions are usually created by the installed plugins, themes, etc. You may try and find the plugin responsible for this header by disabling them one by one and testing the cache functionality of the SG Optimizer after each disabled plugin.

    Best regards,
    Dimo

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Dynamic Cache Not Working’ is closed to new replies.