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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

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

This topic contains 22 replies, has 2 voices.

Last updated by Marcel 2 days, 5 hours ago.

Assisted by: Marcel.

Author Posts
November 5, 2023 at 9:14 am #14732453

arnoP-3

I'm still waiting for Cloudways to increase the header maximum. It's not a quick setting apparently. I will update here once it's done.

November 6, 2023 at 11:01 am #14736735

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Sure, no problem! Thanks.

November 8, 2023 at 7:58 am #14753211

arnoP-3

Hi Marcel,

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!

{"name": "set-cookie", "value": "wp-wpml_current_language=de; expires=Thu, 09-Nov-2023 07:31:31 GMT; Max-Age=86400; path=/; secure"}

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.

Kind regards,
Arno

November 10, 2023 at 3:21 pm #14778495

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi Arno,

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.

Best Regards
Marcel

November 10, 2023 at 3:31 pm #14778529

arnoP-3

Hi Marcel,

Thanks again. To make sure I understand:

1. The hook will be fixed in WPML so it doesn't set so many cookies?

2. For now, as a quick fix, I need to replace this:

do_action('wpml_switch_language', $current_language_code);

by this:

if ($current_language_code == 'de') {
switch_to_locale('de_DE');
}

Should I do that site-wide, or only where I have an issue now, and change it back to the WPML hook once it is fixed?

November 10, 2023 at 4:20 pm #14778911

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

1) we will fix this, so that the headers are not set so many times. It will be changed to be set only once.

2) Yes, you can use it and only set it where you have this issue.

if ($current_language_code == 'de') {
switch_to_locale('de_DE');
}

Best Regards
Marcel

September 17, 2024 at 3:53 pm #16189748

arnoP-3

Hi Marcel,

Is this issue fixed, and in which version?

Thanks,
Arno

September 17, 2024 at 4:10 pm #16189792

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi Arno,

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