502 bad gateway when adding some products in cart

I am using WooCommerce plugin in WordPress on my shopping site. All of a sudden I am getting Error 502 Bad Gateway as soon as I add a product in cart.

This is not happening for all products though. I tried latest product which I added a couple of days ago and it is fine. Then I tried 4, 5 other random products and they are showing this error.

I even changed from “Proxied” to “DNS Only” in CloudFlare control panel but same issue.

Site is hosted on a VPS and nothing has been changed.

That shows that the error comes from your host. You need to clarify this with your host or your web developer.

Site is hosted on a VPS and I haven’t changed anything on it in a long time.

That’s still something you need to clarify with your web developer. As the issue also appears in an unproxied context it has nothing to do with the proxies and is, hence, not Cloudflare related.

Added following lines in nginx.conf fixed the issue

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;