• Resolved danmuc

    (@danmuc)


    My sitemap xml file does not get cached and page enhanced debugging log file shows me:

    no cache entry for example.com/sitemap.xml example.com/sitemap.xml/_index_ssl.html

    that’s logic because the filename is _index_ssl.xml and not .html

    So the request bypasses the cache for some reason.

    My nginx page cache contains the correct rules but for some reason the page does not load the the cached .xml file which exists in the correct folder. When i rename the cached file from _index_ssl.xml to _index_ssl.html it’s working.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @danmuc

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    Are you using the YoastSEO sitemap?
    Is the option “Set expires header” Enabled in Performance>Browser Cache>HTML&XML
    Thank you!

    Thread Starter danmuc

    (@danmuc)

    Hi Marko,
    thanks for your reply. I tested with Yoast Sitemap and also with Google XMP Sitemaps Plugins both are not working. “Set Expires Header” is checked in HTML&XML Area.

    Only pages in XML Format are not getting cached (but the cache files for sitemaps exist in the page_enhanced folder…) but for some reason nginx does not load them correctly?

    Here is the part of page_enhanced in nginx.conf for me it looks good…

    # BEGIN W3TC Page Cache core
    set $w3tc_query_string $query_string;
    if ($w3tc_query_string ~* "^(.*?&|)utm_source(=[^&]*)?(&.*|)$") {
        set $w3tc_query_string $1$3;
    }
    if ($w3tc_query_string ~* "^(.*?&|)utm_medium(=[^&]*)?(&.*|)$") {
        set $w3tc_query_string $1$3;
    }
    if ($w3tc_query_string ~* "^(.*?&|)utm_campaign(=[^&]*)?(&.*|)$") {
        set $w3tc_query_string $1$3;
    }
    if ($w3tc_query_string ~* "^(.*?&|)gclid(=[^&]*)?(&.*|)$") {
        set $w3tc_query_string $1$3;
    }
    if ($w3tc_query_string ~* "^(.*?&|)instance_id(=[^&]*)?(&.*|)$") {
        set $w3tc_query_string $1$3;
    }
    if ($w3tc_query_string ~* "^(.*?&|)instance_secret(=[^&]*)?(&.*|)$") {
        set $w3tc_query_string $1$3;
    }
    if ($w3tc_query_string ~ ^[?&]+$) {
        set $w3tc_query_string "";
    }
    set $w3tc_request_uri $request_uri;
    if ($w3tc_request_uri ~* "^([^?]+)\?") {
        set $w3tc_request_uri $1;
    }
    set $w3tc_rewrite 1;
    if ($request_method = POST) {
        set $w3tc_rewrite 0;
    }
    if ($w3tc_query_string != "") {
        set $w3tc_rewrite 0;
    }
    if ($w3tc_request_uri !~ \/$) {
        set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") {
        set $w3tc_rewrite 0;
    }
    set $w3tc_preview "";
    if ($http_cookie ~* "(w3tc_preview)") {
        set $w3tc_preview _preview;
    }
    set $w3tc_ssl "";
    if ($scheme = https) {
        set $w3tc_ssl _ssl;
    }
    if ($http_x_forwarded_proto = 'https') {
        set $w3tc_ssl _ssl;
    }
    set $w3tc_ext "";
    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_ssl$w3tc_preview.html") {
      set $w3tc_ext .html;
    }
    if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_ssl$w3tc_preview.xml") {
        set $w3tc_ext .xml;
    }
    if ($w3tc_ext = "") {
      set $w3tc_rewrite 0;
    }
    if ($w3tc_rewrite = 1) {
        rewrite .* "/wp-content/cache/page_enhanced/$http_host/$w3tc_request_uri/_index$w3tc_ssl$w3tc_preview$w3tc_ext" last;
    }
    # END W3TC Page Cache core
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @danmuc

    We are checking this and will reply back as soon as we investigate.

    Thank you!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @danmuc

    Thank you for your patience and I am sorry for the late reply.
    We’ve tested this and it appears that W3 Total Cache nginx configuration file generated is actually not attached to root nginx.conf in your environment.
    Can you double-check, please?
    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cached Version of XML Sitemap is not loaded by nginx’ is closed to new replies.