Nginx 502 bad gateway error after switching off the mobile theme

  • Post author:
  • Post last modified:November 14, 2024
  • Reading time:1 mins read

The WPtouch plugin gives a WordPress website the capability to be displayed on mobile devices using a suitable theme. At the end of the web page, there is a toggle button to switch off the mobile theme and use the default desktop theme. That is, a user can toggle between the mobile and the default theme on the mobile device. However, when the toggle button was clicked, the nginx error screen with 502 bad gateway error was displayed.

A check up of the error.log file revealed the following error,

... *29 upstream sent too big header while reading response header from upstream, client:  ...  

The error was resolved after adding the following directives to the nginx configuration file, /etc/nginx.conf,

http {
    ....
    fastcgi_buffers 16 16k;  
    fastcgi_buffer_size 32k;  
    ....
}

Karunesh Johri

Software developer, working with C and Linux.