Hey Patrick,
Thanks for your update. As I expected, yes, this can happen on NGINX servers and I was able to replicate this on one of my servers.
When the form get submitted, the reCaptcha token is submitted to the server as well. Which makes sense, because it should be verified on the server side. Sometimes, especially when Google shows the challenge, the encrypted token is extremely long and when NGINX receives such request it will reject it. This causes 502 Bad Gateway error.
All you have to do is to increase the values of client_body_buffer_size
and client_max_body_size
directives in nginx.conf.
This is what works for me, but as I mentioned, the values can differ from site to site
client_body_buffer_size 16K;
client_max_body_size 16K;
If FastCGI is enabled you can also increase the values of fastcgi_buffers
and fastcgi_buffer_size
directives
My values are:
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
Please let me know!
Cheers,
~Mihai