WP-Admin issues with WP behind Nginx reverse proxy
-
Reverse proxy works fine overall but when logging on the Admin, tons of missing Jquery console errors show up.
The culprit seemed to be load-scripts.php as it seems to be the one loading jquery, and even though request goes through with a 200, it returns 0 byte.
Here’s the error I could see in Apache error_log:
AH01071: Got error 'PHP message: PHP Notice: Undefined index: load in /opt/bitnami/apps/wordpress/htdocs/wp-admin/load-scripts.php on line 23', referer: https://www.domain.com/blog/wp-admin/
After much fiddling around I was able to get it working by putting
define( 'SCRIPT_DEBUG', true );
inwp-config.php
.With this WP-Admin works as well, but it seems like a bad hack to have to do this and this is really not documented. I was pretty lucky to find this out.
What needs to be configured to get wp-admin/load-scripts.php working behind an Nginx reverse proxy?
Here’s the nginx proxy config snippet in place:
location ~* /blog/(.*) { resolver 1.1.1.1; set $blog_host wp.domain.com; proxy_pass https://$blog_host/$1; proxy_cookie_domain $blog_host $host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_ssl_session_reuse on; }
(proxying website and target WP instance are both full HTTPS)
After getting this to work, I also have a 400 error on a GET request on admin-ajax.php
GET wp-admin/admin-ajax.php?action=dashboard-widgets&widget=dashboard_primary&pagenow=dashboard
For some reason there’s also a successful POST on the same resource, making me doubt whether this problem is due to my setup,
- The topic ‘WP-Admin issues with WP behind Nginx reverse proxy’ is closed to new replies.