Article directory
If your WordPress website is experiencing a 502 Bad Gateway error due to the GTranslate plugin, this tutorial will provide you with detailed repair steps, helping you solve the problem step by step, restore your website's multilingual functionality to normal, quickly resolve 502 errors, and improve website traffic!
Why do my multilingual pages get 502 errors? Why are many of the translated pages on my website inaccessible now?
A 502 error sounds tricky, right? Your WordPress plugin's automatic translation function is malfunctioning, and users aren't seeing great content, but rather an ugly "Bad Gateway" message. What's going on? Don't worry, we'll analyze it step by step.
First, a 502 error (Bad Gateway) usually means that the proxy server is having a problem communicating with the upstream server.
It’s like two friends talking on the phone, if one doesn’t get through, the other hangs up. This is common in multilingual websites, especially when you use a WordPress translation plugin like GTranslate.
The root cause of the GTranslate plugin Bad Gateway 502 error
Recently, you may have encountered a problem when working on the multilingual features of your website, that is, some translated pages are suddenly inaccessible. This is most likely caused by a server configuration error.
Enter the gtranslate plugin configuration path:
/home/你的用户名/public_html/你的域名/wp-content/plugins/gtranslate/url_addon- Find the name
config.phpThe default configuration file for .
In your default configuration file, several server names are listed:
$servers = array('van', 'kars', 'sis', 'dvin', 'ani', 'evn', 'vagh', 'step', 'sis', 'tigr', 'ani', 'van');
- What's the problem? If you look closely, you'll see that there are two
'ani'. - You guessed it! This repeat
'ani'This may cause conflicts in communications between servers. - It's like two people trying to grab the microphone at the same time, and no one can speak.
Problem Solution
To fix this problem, you took a simple but effective step—deleting one of the duplicates.'ani', then your problem is solved!
The code becomes this:
$servers = array('van', 'kars', 'sis', 'dvin', 'evn', 'vagh', 'step', 'sis', 'tigr', 'ani', 'van');
If this doesn't solve the problem, just delete 'ani'. Clean and simple!
Will it happen again after the next GTranslate update?
If you are using GTranslate plugin and find that you need to delete'ani'If the problem is solved, it is likely that there is a blocking phenomenon on the server side.
The problem is that future updates of the plugin may overwrite yourconfig.phpfile, causing the same problem to recur.
So how do we prevent this problem from recurring? Simple! Whitelist GTranslate's IP addresses ; this can effectively prevent such problems from happening again.
How to whitelist IP addresses for GTranslate?

in UseCloudflareFirewall functionality :
Open Cloudflare, go to the Tools section of the firewall, and select IP Access Rules. Here you need to add all the relevant IP addresses and grant "Allow" access to each one. Note that IP addresses need to be handled individually and you cannot add a range at once.Adjust Cloudflare’s DNS settings :
At the same time, you also need to make sure that the CNAME records for all languages are changed from "DNS only" to "PROXY" (orange cloud). This step ensures that all translation requests are processed through the Cloudflare proxy, thereby improving stability.
GTranslate Whitelist IP Addresses
Here are the GTranslate server IP addresses that need to be whitelisted:
51.210.136.112
51.210.136.113
51.210.136.114
51.210.136.115
51.210.136.116
51.210.136.117
51.210.136.118
51.210.136.119
51.210.136.120
51.210.136.121
51.210.136.122
51.210.136.123
51.210.136.124
51.210.136.125
51.210.136.126
51.210.136.127
37.59.139.248
37.59.139.249
37.59.139.250
37.59.139.251
37.59.139.252
37.59.139.253
37.59.139.254
37.59.139.255
Summary: How to completely solve the 502 error problem
In summary, the 502 Bad Gateway error is usually related to poor communication between servers, especially when you are dealing with multilingual pages, GTranslate's translation service may encounter this problem.
By removing the redundant server name, you have successfully resolved the issue.
To prevent future issues, it is highly recommended that you whitelist GTranslate's IP addresses and configure DNS and firewall accordingly in Cloudflare.
Finally, remember that while technical problems are annoying, their solutions are not complicated.
You just need to pay more attention to server configuration and plugin compatibility.
In the future, your website will run smoother and your users will no longer encounter the terrible "Bad Gateway" page.
What should you do next? Immediately check your Cloudflare settings to ensure that GTranslate's IP address is whitelisted and that CNAME records for all languages are configured correctly.
This will help prevent future 502 errors and ensure your website’s multilingual functionality always works as expected.
Hopefully, the article "Solving Website 502 Errors! A Complete Guide to Fixing GTranslate Plugin Bad Gateway Issues" shared on Chen Weiliang's blog ( https://www.chenweiliang.com/ ) will be helpful to you.
Feel free to share this article's link: https://www.chenweiliang.com/cwl-32110.html
