• Resolved frafor

    (@frafor)


    Hi guys, I’m giving a go to this plugin which seems to be awesome.

    I have a bilingual ecommerce website cloned on a test domain to see how it works.

    It’s all based on WPML+WooCommerce.

    The website is EN/DE with DE being the primary language. Permalink structure is set to show the language base for both, so we have:

    domainname.com/de/
    domainname.com/en/

    After a general plugin setup, I noticed on Cloudflare that this is the general pagerule being created:

    View post on imgur.com

    So that should mean that all the /en/ content won’t be cached right?

    Am I supposed to add domainname.com/en/* as a second rule?

    Thanks

Viewing 15 replies - 1 through 15 (of 27 total)
  • Plugin Contributor iSaumya

    (@isaumya)

    Hi @frafor,
    Can you confirm as if you have two separate WP installs or just one WP site? As the page Rule URL is taken from the site URL mentioned in your General Settings in WP dashboard.

    Thread Starter frafor

    (@frafor)

    Hi Saumya,

    It’s only 1 site. WPML allows you to configure languages in several ways within 1 wp instance, f.eg you could have:

    A) per subdomain:
    en.mydomain.com
    de.mydomain.com

    B) per language slug on other languages:
    mydomain.com -> it’s the main language
    mydomain.com/en/ -> other languages

    C) per language slug on all languages:
    mydomain.com/de/ -> language appears even on the primary language
    mydomain.com/en/

    D) per-GET parameter (no pretty permalink):
    mydomain.com/?lang={lang_code}

    In my case, it’s setup as C).

    It may be that WPML filters the site URL (or you hook on the site URL in a moment when WPML has already filtered it). This is a common problem, W3TC too does it.

    As a workaround I’ve manually changed the rule in Cloudflare to mydomain.com/* and I started to get HITs, however it would be better to have it fixed.

    Plugin Contributor iSaumya

    (@isaumya)

    Hi @frafor,
    Yes manually changing the Cloudflare rule will fix the problem. But can you send me a screenshot of your WP Admin > Settings > General Page?

    Thread Starter frafor

    (@frafor)

    Site Address is like: mydomain.com
    WordPress URL is like: mydomain.com/v1/

    On mydomain.com there’s a copy of wordpress’s root index.php with the last line edited to point to /v1/blog-header.php like:

    require __DIR__ . ‘/v1/wp-blog-header.php’;

    Plugin Contributor iSaumya

    (@isaumya)

    That’s the problem. The plugin is thinking that your WP has been installed in a sub directory

    Thread Starter frafor

    (@frafor)

    I dont think you are following. WordPress is actually installed in a subdirectory. Which is v1. permalink/URLs are set to rewrite it so that frontend works without v1. There’s a guide in the codex for this “giving WordPress its own directory”. WPML then rewrites the URLs again according to the language settings. Which is /en/ and /de/ not /v1/.

    This just to say that the issue is not my installation directory, but the way you retrieve the siteurl when WPML is active and set to display the language slug for all languages.

    • This reply was modified 5 years, 5 months ago by frafor.
    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @frafor ,
    the plugin uses the home_url() WordPress function to get the home URL. Maybe WPML rewrites its value with some filter. Can you please check if the value returned by home_url() is “domainname.com/en/” in your case?

    Thread Starter frafor

    (@frafor)

    Hi Salvatore, yes the problem is that function and it’s the same issue W3TC has when used to minify stuff on a WPML Setup.

    Reference for the WPML issue:
    https://wpml.org/forums/topic/w3tc-is-not-minifying-files-in-other-language-directories/#post-4436511

    Raja Mohammed solution rewrites home_url_regexp() by using get_option(‘home’) in place of get_home_url().

    This is the original home_url_regexp(): https://github.com/szepeviktor/w3-total-cache-fixed/blob/d7c4e8f9648f6dde232430feec27d241359761f1/Util_Environment.php#L490

    So that should be the issue.

    Then again I am having another issue: it seems that pages aren’t cleared properly on edit_post or save_post. They are saved properly thou because if I add the cache buster parameter, they work.

    The only way I have to flush CF cache seems to be to purge whole cache, however this comes at a resource cost.

    ajax_purge_single_post_cache seems not to work either.

    The log just reports:

    [2021-01-14 17:48:46] [cache_controller::start_cache_preloader_for_specific_urls] Adding 11 URLs to preloader queue
    [2021-01-14 17:48:47] [cache_controller::purge_urls] Purged specific URLs from Cloudflare cache
    [2021-01-14 17:48:47] [cache_controller::ajax_purge_single_post_cache] Purge Cloudflare cache for only post id 68 and related contents

    However I cannot see the changes on any browser, unless I click “purge whole cache” later.

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @frafor ,
    thanks, I will use a custom “get_home” and I will release the new version asap.

    For your second issue please:

    • Disable the Purge HTML pages only option if enabled
    • Set the log verbosity to High then edit again a post and check the logs

    You should see the requests sent to Cloudflare. Please paste them here

    Thread Starter frafor

    (@frafor)

    Thanks

    So this is the log after saving a post:

    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:52] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:55] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents

    Nothing changes.
    Then I purged single page cache via Ajax. The below added.

    [2021-01-14 18:37:53] [cloudflare::purge_cache_urls] Request URL: https://api.cloudflare.com/client/v4/zones/0749be31f1028ecf4e137a08b741121d/purge_cache
    [2021-01-14 18:37:53] [cloudflare::purge_cache_urls] Request Body: {"files":["https:\/\/mydomain.com\/de\/wie\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-de","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/2\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/3\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/4\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/5\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/6\/","https:\/\/mydomain.com\/de\/author\/username\/","https:\/\/mydomain.com\/de\/author\/username\/feed\/","https:\/\/mydomain.com\/de\/","https:\/\/mydomain.com\/de\/blog\/"]}
    [2021-01-14 18:37:54] [cloudflare::purge_cache_urls] Response: {
      "result": {
        "id": "0749be31f1028ecf4e137a08b741121d"
      },
      "success": true,
      "errors": [],
      "messages": []
    }
    
    [2021-01-14 18:37:54] [cache_controller::purge_object_cache] Purge object cache
    [2021-01-14 18:37:56] [cloudflare::get_cloudflare_cookie] Cookies found: Array
    (
        [0] => WP_Http_Cookie Object
            (
                [name] => __cfduid
                [value] => dc016948b97d12c95005f67942babb2251610649474
                [expires] => 1613241474
                [path] => /
                [domain] => mydomain.com
                [host_only] => 
            )
    
    )
    
    [2021-01-14 18:37:56] [cache_controller::start_cache_preloader_for_specific_urls] Adding these URLs to preloader queue: Array
    (
        [0] => https://mydomain.com/de/wie/
        [1] => https://mydomain.com/de/?translation_priority=optional-de
        [2] => https://mydomain.com/de/?translation_priority=optional-depage/2/
        [3] => https://mydomain.com/de/?translation_priority=optional-depage/3/
        [4] => https://mydomain.com/de/?translation_priority=optional-depage/4/
        [5] => https://mydomain.com/de/?translation_priority=optional-depage/5/
        [6] => https://mydomain.com/de/?translation_priority=optional-depage/6/
        [7] => https://mydomain.com/de/author/username/
        [8] => https://mydomain.com/de/author/username/feed/
        [9] => https://mydomain.com/de/
        [10] => https://mydomain.com/de/blog/
    )
    
    [2021-01-14 18:37:57] [cache_controller::purge_urls] Purged specific URLs from Cloudflare cache
    [2021-01-14 18:37:57] [cache_controller::ajax_purge_single_post_cache] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:37:58] [preloader::task] Preloading URL https://mydomain.com/de/presse/
    [2021-01-14 18:38:05] [preloader::task] Preloading URL https://mydomain.com/de/my-produkte/
    [2021-01-14 18:38:13] [preloader::task] Preloading URL https://mydomain.com/de/wo/
    [2021-01-14 18:38:19] [preloader::task] Preloading URL https://mydomain.com/de/clientt/
    [2021-01-14 18:38:25] [preloader::task] Preloading URL https://mydomain.com/en/where/
    [2021-01-14 18:38:31] [preloader::task] Preloading URL https://mydomain.com/de/jobs/

    Nothing changed still. Some weird GET parameters popping up on some URLs though.
    Then if I click Purge whole cache.

    [2021-01-14 18:45:26] [cache_controller::ajax_purge_whole_cache] Purge whole Cloudflare cache
    [2021-01-14 18:45:26] [cloudflare::purge_cache] Request URL: https://api.cloudflare.com/client/v4/zones/0749be31f1028ecf4e137a08b741121d/purge_cache
    [2021-01-14 18:45:26] [cloudflare::purge_cache] Request Body: {"purge_everything":true}
    [2021-01-14 18:45:28] [cloudflare::purge_cache] Response: {
      "result": {
        "id": "0749be31f1028ecf4e137a08b741121d"
      },
      "success": true,
      "errors": [],
      "messages": []
    }
    
    [2021-01-14 18:45:28] [cache_controller::purge_object_cache] Purge object cache
    [2021-01-14 18:45:28] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/post-sitemap.xml
    [2021-01-14 18:45:30] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/page-sitemap.xml
    [2021-01-14 18:45:31] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/product-sitemap.xml
    [2021-01-14 18:45:33] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/oel-product-sitemap.xml
    [2021-01-14 18:45:34] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/category-sitemap.xml
    [2021-01-14 18:45:36] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/product_cat-sitemap.xml
    [2021-01-14 18:45:37] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/oel-category-sitemap.xml
    [2021-01-14 18:45:39] [cloudflare::start_preloader_for_all_urls] Getting last published posts for post types: Array
    (
        [0] => post
        [1] => page
        [2] => product
        [3] => oel-product
    )
    
    [2021-01-14 18:45:39] [cache_controller::start_cache_preloader_for_specific_urls] Unable to start the preloader. Another preloading process is currently running.
    [2021-01-14 18:45:39] [cache_controller::purge_all] Purged whole Cloudflare cache

    And the cache is finally cleared.

    If you want to lurk to the website, is on a test domain so if you write to me at hello [at] sito.express, I can send you credentials.

    Thread Starter frafor

    (@frafor)

    Thanks

    So this is the log after saving a post:

    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:51] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:52] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:36:55] [cache_controller::purge_cache_on_post_edit] Purge Cloudflare cache for only post id 68 and related contents

    Nothing changes.
    Then I purged single page cache via Ajax. The below added.

    [2021-01-14 18:37:53] [cloudflare::purge_cache_urls] Request URL: https://api.cloudflare.com/client/v4/zones/0749be31f1028ecf4e137a08b741121d/purge_cache
    [2021-01-14 18:37:53] [cloudflare::purge_cache_urls] Request Body: {"files":["https:\/\/mydomain.com\/de\/wie\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-de","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/2\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/3\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/4\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/5\/","https:\/\/mydomain.com\/de\/?translation_priority=optional-depage\/6\/","https:\/\/mydomain.com\/de\/author\/username\/","https:\/\/mydomain.com\/de\/author\/username\/feed\/","https:\/\/mydomain.com\/de\/","https:\/\/mydomain.com\/de\/blog\/"]}
    [2021-01-14 18:37:54] [cloudflare::purge_cache_urls] Response: {
      "result": {
        "id": "0749be31f1028ecf4e137a08b741121d"
      },
      "success": true,
      "errors": [],
      "messages": []
    }
    
    [2021-01-14 18:37:54] [cache_controller::purge_object_cache] Purge object cache
    [2021-01-14 18:37:56] [cloudflare::get_cloudflare_cookie] Cookies found: Array
    (
        [0] => WP_Http_Cookie Object
            (
                [name] => __cfduid
                [value] => dc016948b97d12c95005f67942babb2251610649474
                [expires] => 1613241474
                [path] => /
                [domain] => mydomain.com
                [host_only] => 
            )
    
    )
    
    [2021-01-14 18:37:56] [cache_controller::start_cache_preloader_for_specific_urls] Adding these URLs to preloader queue: Array
    (
        [0] => https://mydomain.com/de/wie/
        [1] => https://mydomain.com/de/?translation_priority=optional-de
        [2] => https://mydomain.com/de/?translation_priority=optional-depage/2/
        [3] => https://mydomain.com/de/?translation_priority=optional-depage/3/
        [4] => https://mydomain.com/de/?translation_priority=optional-depage/4/
        [5] => https://mydomain.com/de/?translation_priority=optional-depage/5/
        [6] => https://mydomain.com/de/?translation_priority=optional-depage/6/
        [7] => https://mydomain.com/de/author/username/
        [8] => https://mydomain.com/de/author/username/feed/
        [9] => https://mydomain.com/de/
        [10] => https://mydomain.com/de/blog/
    )
    
    [2021-01-14 18:37:57] [cache_controller::purge_urls] Purged specific URLs from Cloudflare cache
    [2021-01-14 18:37:57] [cache_controller::ajax_purge_single_post_cache] Purge Cloudflare cache for only post id 68 and related contents
    [2021-01-14 18:37:58] [preloader::task] Preloading URL https://mydomain.com/de/presse/
    [2021-01-14 18:38:05] [preloader::task] Preloading URL https://mydomain.com/de/my-produkte/
    [2021-01-14 18:38:13] [preloader::task] Preloading URL https://mydomain.com/de/wo/
    [2021-01-14 18:38:19] [preloader::task] Preloading URL https://mydomain.com/de/clientt/
    [2021-01-14 18:38:25] [preloader::task] Preloading URL https://mydomain.com/en/where/
    [2021-01-14 18:38:31] [preloader::task] Preloading URL https://mydomain.com/de/jobs/

    Nothing changed still. Some weird GET parameters popping up on some URLs though.
    Then if I click Purge whole cache.

    [2021-01-14 18:45:26] [cache_controller::ajax_purge_whole_cache] Purge whole Cloudflare cache
    [2021-01-14 18:45:26] [cloudflare::purge_cache] Request URL: https://api.cloudflare.com/client/v4/zones/0749be31f1028ecf4e137a08b741121d/purge_cache
    [2021-01-14 18:45:26] [cloudflare::purge_cache] Request Body: {"purge_everything":true}
    [2021-01-14 18:45:28] [cloudflare::purge_cache] Response: {
      "result": {
        "id": "0749be31f1028ecf4e137a08b741121d"
      },
      "success": true,
      "errors": [],
      "messages": []
    }
    
    [2021-01-14 18:45:28] [cache_controller::purge_object_cache] Purge object cache
    [2021-01-14 18:45:28] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/post-sitemap.xml
    [2021-01-14 18:45:30] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/page-sitemap.xml
    [2021-01-14 18:45:31] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/product-sitemap.xml
    [2021-01-14 18:45:33] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/oel-product-sitemap.xml
    [2021-01-14 18:45:34] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/category-sitemap.xml
    [2021-01-14 18:45:36] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/product_cat-sitemap.xml
    [2021-01-14 18:45:37] [cloudflare::start_preloader_for_all_urls] Preload sitemap https://mydomain.com/de/oel-category-sitemap.xml
    [2021-01-14 18:45:39] [cloudflare::start_preloader_for_all_urls] Getting last published posts for post types: Array
    (
        [0] => post
        [1] => page
        [2] => product
        [3] => oel-product
    )
    
    [2021-01-14 18:45:39] [cache_controller::start_cache_preloader_for_specific_urls] Unable to start the preloader. Another preloading process is currently running.
    [2021-01-14 18:45:39] [cache_controller::purge_all] Purged whole Cloudflare cache

    And the cache is finally cleared.

    If you want to lurk to the website, is on a test domain so if you write to me at sito punto express, I can send you credentials.

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    The cache is purged but the issue is causes by that weird parameters. I need to investigate into this.

    Thread Starter frafor

    (@frafor)

    Hi Salvatore, thanks for the insight. I thought too they were related, but I don’t have extensive experience with Cloudflare.

    Anyway, those parameters come from WPML. If you need FTP/wp-admin access to the website in question and/or a legit WPML copy just write to me – it’s a test environment and I have one of the last true-lifetime licences.

    hello -chiocciola- sito.express

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @frafor ,
    thank you. If I have problems to replicate the issue, I will contact you. Let me few days to check

    Thread Starter frafor

    (@frafor)

    Thanks for the support, I’ll try to have a look too!

Viewing 15 replies - 1 through 15 (of 27 total)

The topic ‘Page rule setting with WPML’ is closed to new replies.