Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by Dražen 1 year, 5 months ago.

Assisted by: Dražen.

Author Posts
October 30, 2023 at 10:14 am #14689837

Sebastian

I am having the issue that every first time visit is a cache miss. I have opened a ticket with Litespeed: https://wordpress.org/support/topic/cache-miss-first-visit/#post-17159606

October 31, 2023 at 7:55 am #14697089

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

1) I have checked the shared ticket and chat with my colleague, and I understand this issue happens only when browser redirect WPML mode is enabled ?

2) I created a minimal installation of WordPress, WPML, and all necessary WPML add-ons.

You can access the WordPress dashboard using the link below:
- hidden link

Kindly follow the steps below:
- Set up WPML plugins
- Install LiteSpeed plugin
- Try to replicate the issue in simple example
- Share with me step by step guide on how can I check the issue and step you did

This will help us to report the probable issue to the compatibility team and solve the possible problem faster.

Thanks,
Drazen

November 1, 2023 at 11:14 am #14706765

Sebastian

Hello,

No, I have disabled the "Browser language redirect" but enabled "Language filtering for AJAX operations". It seems that as soon as LiteSpeed Cache sees any WPML cookie it will not cache the first-visit, because he thinks he needs to exclude it, to be able to redirect to a specific language. LS Cache seems to not take the WPML settings into account to see if the Browser language redirect is enabled or not.

I have opened up a ticket with LitespeedCache too: https://wordpress.org/support/topic/cache-miss-first-visit/#post-17161453

A Litespeed Partner has shared some light into the issue:
I want to help bring a little more understanding and clarity to this discussion, even though @qtwrk has already created facts. The pivotal point is the recognition of the language based on the data that the browser sends to the server or to WPML. For this to work, you need PHP. If a page is cached, then there is no more PHP because a cached page is actually just a static text file and a text file can no longer execute PHP. To ensure that this detection is still possible, the cache plugin deactivates the cache at the first request if the WPML plugin is installed. Unfortunately, the cache plugin does not take the WPML settings into account and deactivates the cache on the first request regardless of the WPML settings. To put it in your language, this well-intentioned measure to create compatibility between WPML and LSCWP “war für’n Oarsch”. This means that the cache plugin is only compatible with WPML if the WPML settings regarding automatic redirects are taken into account, which it does not do. Therefore, this problem cannot be solved as long as the cache plugin does not take the said WPML settings into account.

I cannot replicate it in the test environment has it is not running on a OpenLiteSpeed or Litespeed Enterprise server. This server environment is needed to make LS cache working.

WPML has to reach out to Litespeed to make sure the two plugins are actually fully compatible, as you note it on your website: https://wpml.org/plugin/litespeed-cache/

Currently the LiteSpeed Cache mishandles the first-visit, when WPML sets any cookie, but it should only disable first-visit cache, when "Browser language redirect" is really switched on. The best way would be to make sure that LS Cache Plugin checks the WPML settings if "Browser language redirect" is turned on.

Would it be possible that WPML can get in touch with Litespeed to make sure the both plugins work together in a right manner?

It is mandatory that he first-visit is actually a cache hit and not a miss, because especially on the first-visit speed is everything.

Thanks a lot!

November 1, 2023 at 1:18 pm #14707805

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for providing an informative reply, it is very helpful.

Before I escalate, would you be able to provide us a test site with only WPML Plugins, and LS while using the WP default theme, so we can check and confirm the issue and our 2nd tier can further confirm this before proceeding forward?

I have enabled private reply for you.

Let me know.

Thanks,
Drazen

November 6, 2023 at 2:35 pm #14738993

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

I have checked and I can see the same behavior with and without, WPML, there is a miss on the first cache load.

Video: hidden link

Maybe I am checking or doing something wrong, please check the video and let me know.

Thanks,
Drazen

November 6, 2023 at 2:43 pm #14739057

Sebastian

Hello,
The first visit after the LS cache has been emptied is a miss, that is right, as the page needs to be re-cached. But if you now open the site in another private window, the cache will be a hit, as it has one copy in the cache, which can be served.

LS cache empty => First visit: miss => First visit (other private browser window): hit.

When the WPML AJAX is enabled the issue is that every first visit is a miss, so there is a cached version available, but it does not get served, because LS cache thinks it must disable the cache on first visit, because of the WPML Ajax cookie (which is not right, das it should only do that if WPML browser redirect is turned on).

LS cache empty => First visit: miss => First visit (other private browser window): again miss.

November 6, 2023 at 2:55 pm #14739099

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back.

Do you mean it depends on the WPML "Language filtering for AJAX operations" option?

If so, I think that is expected since as we say in our docs, we set the cookie even if the site is cached, so Ajax operation can work correctly, which then causes your cache to miss.

You are mixing browser redirect settings and Ajax filtering, which are different things and used for different situations.

For users that are not logged-in, WPML checks if this setting is turned on and if so, the language cookie is set using JavaScript. This allows WPML to set the language cookie even if the site is cached.

You are free to disable this option, if you do not have any issues with Ajax filtering.

- https://wpml.org/documentation/getting-started-guide/language-setup/enabling-language-cookie-to-support-ajax-filtering/

Let me know.

Regards,
Drazen

November 6, 2023 at 3:03 pm #14739223

Sebastian

Yes. I try to make it clearer.
WPML language browser redirect is always disabled => This would need PHP, so cache on first visit is not possible.

When I enable "Language filtering for AJAX operations" => This cookie is set by Javascript, so that it will also work on cached pages.

The issue now is that LS cache does not register the difference. If it sees a WPML cookie, it will disable the cache on first visit, which results in serving non-cached pages, which is really bad for speed.

As the "Language filtering for AJAX operations" is also working on cached pages, because it loads by JS, it does not need LS cache to disable cached first visit.

Current behaviour: Language filtering for AJAX operations on => LS cache does not serve cached version

Expected behaviour Language filtering for AJAX operations on => LS cache serve cached version

November 7, 2023 at 8:39 am #14744417

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for getting back and sharing more information on this.

Okay, I can check further with 2nd tier on this and if there is anything we can do.

One more thing, I am trying to confirm what you explained, but in the private incognito window I still keep getting LS cache hit even with WPML Ajax enabled.

Can you please share step by step-by-step guide on how can I check the issue or a video of the steps?

Thanks,
Drazen

The topic ‘[Closed] Litespeed every first time visit is a cache miss’ is closed to new replies.