[Escalated to WPML Developers team] Wpml_switch_language causing Cloudflare error 520
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.
Our wait time is higher than usual, please make sure you are meeting the minimum requirement - https://wpml.org/home/minimum-requirements before you report issues, and if you can take a look at current Known Issues - https://wpml.org/known-issues/. Thank you.
Cloudways changed this NGINX setting to allow larger HTTP headers by the server:
large_client_header_buffers 16 128k;
Now it works, but only if I disable proxying via Cloudflare by changing the A record in the Cloudflare DNS. I am now waiting for Cloudflare Support to see why they still reject the page.
I was able to make a HAR file with Cloudflare completely by-passed, and one with Cloudflare enabled. You'll find them here: hidden link
I'd appreciate it if you'd take a look. Because I noticed something strange. This section below is in the HAR files 300 times!
That can't be good, right? It may be the root of this issue. I think it has something to do with the code we discussed, and executing that code a lot of times on the same page. It looks like it sets a new cookie each time, causing a huge header.
Cloudflare may get back to me saying that they accept a fixed max header, and can't change that. Which would mean the header must be limited on our end.
indeed, it seems that the large headers are breaking some part of the "proxy chain" with the environments (too large).
We checked it, and this cookie is set by us when the method $wpml_request_handler->set_language_cookie is used in $sitepress->switch_lang, which is called from the problematic hook do_action('wpml_switch_language', $current_language_code);. This confirms that the header issue is directly related to your snippet.
We will handle this via our code as a minor issue, but it will be better for the time being to use the alternative switch_to_locale as the code that you are using is creating the issue.
the issue is still unresolved and is currently being treated as a minor one. Unfortunately, I can't provide an ETA, but I’ll keep you updated as things progress.
Thanks for your understanding!
Best regards,
Marcel
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.