403 POST errors with /wp-admin/admin-ajax.php breaks some plugins.
-
We have a self-hosted website that uses a calendaring plugin. I have complete access to the virtual machine hosting the website, Fedora 19 with WordPress 3.5.2.
We use a calendaring plugin to display upcoming events. The plugin works as expected for users accessing it from the same subnet as the website. But it stays stuck with a graphic that says, “Loading” from anywhere else in the world.
After countless frustrating hours of troubleshooting over several months, I noticed errors like this in /etc/httpd/logs/error_log:
[Thu Sep 18 20:43:04.282395 2014] [authz_core:error] [pid 15303] [client 1.2.3.4:62753] AH01630: client denied by server configuration: /usr/share/wordpress/wp-admin/admin-ajax.php, referer: https://www.example.org/calendar/
And I see entries like this in /etc/httpd/logs/access_log:
1.2.3.4 – – [18/Sep/2014:20:43:04 -0500] “POST /wp-admin/admin-ajax.php HTTP/1.1” 403 225 “https://www.example.org/calendar/” “Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36”
I dummied up the requesting IP Address and website name above.
OK, wonderful – we have some kind of permission issue with this file named admin-ajax.php. And sure enough, I can work around the problem with a .conf file in /etc/httpd/conf.d with a directive like this to liberalize the permissions on my wp-admin directory:
<Directory /usr/share/wordpress/wp-admin> ## AllowOverride Options AllowOverride All <IfModule mod_authz_core.c> # Apache 2.4 ##Require local ##Require ip 192.168.10 Require all granted </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from ::1 ##Allow from 192.168.10 Allow from all </IfModule> </Directory>
Note the commented out references to the internal subnet. This feels like leaving the front door of my house open and hanging a neon “Rob me” sign above it.
And that leads to my questions:
1 – How do I liberalize the permissions around the individual file named admin-ajax.php without exposing the whole wp-admin directory?
2 – Why does this ajax-admin.php error only break some plugins and not others, even though every access to every piece of the website seems to trigger the error?
3 – Why in the world do I need to allow the whole world to do HTML POST commands to this one file? I am not a WordPress internals expert and I don’t know anything about Ajax and PHP – does POST in this case really mean it’s just sending admin-ajax.php some kind of command, and admin-ajax.php is tough enough to withstand lots of abuse?
There are hundreds of references to admin-ajax.php across Google, but nothing I can find so far that answers my questions. So maybe this can be helpful to others.
thanks
– Greg Scott
- The topic ‘403 POST errors with /wp-admin/admin-ajax.php breaks some plugins.’ is closed to new replies.