Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin-ajax.php: 502 Bad Gateway #612

Closed
3 tasks done
vercotux opened this issue Jul 5, 2016 · 3 comments
Closed
3 tasks done

admin-ajax.php: 502 Bad Gateway #612

vercotux opened this issue Jul 5, 2016 · 3 comments

Comments

@vercotux
Copy link

vercotux commented Jul 5, 2016

Submit a feature request or bug report

  • This is a bug report
  • This request isn't a duplicate of an existing issue
  • I've read the docs and followed them (if applicable)

What is the current behavior?

Plugins which rely on admin-ajax.php in the admin dashboard (Appearance --> Widgets) are not working.

What is the expected or desired behavior?

Being able to use the admin dashboard for plugins which rely on admin-ajax.php


Bug report

On development (Vagrant) the admin-ajax.php script seems to be broken or otherwise inaccessible

This is the server response when a plugin tries to access https://example.dev/wp/wp-admin/admin-ajax.php:

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

This looks like some sort of issue with nginx.

Please describe your local environment:

Ansible version: 2.1.0.0

OS: Ubuntu 16.04 x64

Vagrant version: 1.7.4

Where did the bug happen? Development or remote servers?

Development

Please provide a repository or your wordpress_sites config (if possible):

wordpress_sites:
  example.com:
    site_hosts:
      - example.dev
      - example2.dev
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    site_name: Example Site
    admin_email: admin@example.dev
    multisite:
      enabled: true
      subdomains: true
    ssl:
      enabled: true
      provider: self-signed
    cache:
      enabled: false
    env:
      domain_current_site: example.dev
      wp_home: https://example.dev
      wp_siteurl: https://example.dev/wp
@slackday
Copy link
Contributor

slackday commented Jul 5, 2016

Awesome! Not a awesome bug but awesome that I am not alone with this bug. 😆

Have had this issue for a while (on different sites but with the same environment/version. I have failed for some time to find the cause of the issue. But it seems to be related to some plugins running on development (Vagrant) box.

For me it happens in wp-admin on all pages that has the grid view of the media gallery. I.e. under Media or every edit screen where I attach/upload/edit images.

It happens if both Advanced Custom Fields and Query Monitor plugins are activated. If I deactivated either of these plugins the issue stop. This bug does not appear on staging/production environment with the same plugin configuration.

Are you using any of these plugins as well or any other plugins that's causing this issue for you?

I hope this information helps someone reproduce this issue and find a solution.

@vercotux
Copy link
Author

vercotux commented Jul 5, 2016

For me it happens with WordPress Meta Data & Taxonomies Filter, when adding their widget.

And indeed the bug does not occur on production & staging environments.

@swalkinshaw
Copy link
Member

Really strange that it's only happening on development, but I figured out what's going on.

@vercotux thanks for the good bug report but always remember to check logs too :)

In /srv/www/example.com/logs/error.log:

2016/07/08 03:10:58 [error] 7744#7744: *100 upstream sent too big header while reading response header from upstream, client: 192.168.50.1, server: example.dev, request: "POST /wp/wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-wordpress.sock:", host: "example.dev", referrer: "https://example.dev/wp/wp-admin/widgets.php"

I tried bumping nginx_fastcgi_buffer_size to 8k and it fixed the issue.

It's a bit of a guessing game with these values but we might have to bump that value permanently.

swalkinshaw added a commit that referenced this issue Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants