Resolved: Nginx + Apache WordPress AJAX/Route Issues with Block Widgets

Vibe

Verified User
Joined
Aug 3, 2005
Messages
124
Hello,

Recently I discovered an issue that occurs on three DirectAdmin servers. I have spent a fair amount of time troubleshooting (Google, WordPress, GitHub, multiple web browsers, etc.) but am not finding a resolution. I have found other users online that have experienced the same problem, and have suggested it is a configuration issue with Apache and/or NGINX. I am running default installations of Apache/NGINX reverse proxy from CustomBuild (i.e. no customization).

The issue pertains to WordPress and Gutenberg block widgets (i.e., the "new" WordPress block widgets feature). "Legacy" Widgets work fine.

When attempting to save Block Widgets through the default URL path (i.e. Dashboard > Appearance > Widgets) - they will not save. Instead, the error message below is displayed:

"There was an error. You are probably offline."

Chrome displays the following route error for all WordPress installations (on all servers):

{"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}

URL for the above error:

Code:
https://www.domain.com/wp-json/batch/v1?_locale=user

What is odd is that I am able to save block widgets through the WordPress Customizer on all servers (i.e. Appearance > Customize > Widgets).
  • I have disabled ConfigServer to see if it was firewall related - it does not appear to be the case (unless I am missing something).
  • I have installed and tested a base installation of WordPress without plugins - the same error occurs.
  • WordPress is configured to display errors - none are shown.
  • There are no errors recorded by the web server(s).
  • I have found numerous references online about similar errors, however, they are typically a few years old and not related to saving widgets.
When testing on a development server configured only with Apache, I am able to save block widgets without issue. However, as it stands, the default WordPress block widgets feature does not appear to be functional on DirectAdmin Apache/NGINX servers.

After much investigation I found the following links that appear to be the same issue I am experiencing. They suggest a possible loopback issue and/or NGINX config issue:

https://forum.infinityfree.net/t/wo...as-an-error-you-are-probably-offline/57183/36

https://stackoverflow.com/questions...pi-405-error-unable-to-save-gutenberg-widgets

I have attached the headers from Chrome when the error occurs (substituted "real" domain).

Can anyone running Apache/NGINX reverse proxy confirm their ability to use the WordPress block widgets feature? Has anyone experienced anything similar? Any suggestions for a resolution?

My concern is that this issue is not specific to me - but to DirectAdmin Apache/NGINX by default.

Thank you for any assistance.
 

Attachments

  • Headers.txt
    1.3 KB · Views: 1
Last edited:
Hello,

Recently I discovered an issue that occurs on three DirectAdmin servers. I have spent a fair amount of time troubleshooting (Google, WordPress, GitHub, multiple web browsers, etc.) but am not finding a resolution. I have found other users online that have experienced the same problem, and have suggested it is a configuration issue with Apache and/or NGINX. I am running default installations of Apache/NGINX reverse proxy from CustomBuild (i.e. no customization).

The issue pertains to WordPress and Gutenberg block widgets (i.e., the "new" WordPress widgets feature). When attempting to save Widgets through the default URL path (i.e. Dashboard > Appearance > Widgets) - they will not save. Instead, the error message below is displayed:

"There was an error. You are probably offline."

Chrome displays the following route error for all WordPress installations (on all of my DirectAdmin servers):

ERROR: {"code":"rest_no_route","message":"No route was found matching the URL and request method.","data":{"status":404}}

"Example" URL:
What is odd is that I am able to save widgets through the WordPress Customizer on all servers (i.e. Appearance > Customize > Widgets).
  • I have disabled ConfigServer to see if it was firewall related - it does not appear to be the case, unless I am missing something
  • I have installed a base installation of WordPress without plugins - the same error occurs
  • WordPress is configured to display errors - none are shown. There are no errors recorded by the web server(s)
  • I have found numerous instances online about the error I am seeing, however, they are typically a few years old and often reference saving posts
When testing on a development server configured only with Apache, I am able to save block widgets without issue. However, as it stands, the default WordPress block widgets feature does not appear to be functional on my Apache/NGINX servers.

After much investigation I found the following links that appear to be the same issue I am experiencing. They suggest a possible loopback issue and/or NGINX config issue:

https://forum.infinityfree.net/t/wo...as-an-error-you-are-probably-offline/57183/36

https://stackoverflow.com/questions...pi-405-error-unable-to-save-gutenberg-widgets

I have attached the headers from Chrome when the error occurs (substituted "real" domain).

Can anyone running Apache/NGINX reverse proxy confirm their ability to use the WordPress block widgets feature? Has anyone experienced anything similar? Any suggestions for a resolution? My concern is that this issue is not specific to me - but Apache/NGINX by default.

Thank you for any assistance.
Hi, Vibe. Can we please try the following?
1) Go to your site & do whatever it is you do to reproduce the error. Make note of the time you did that, please.
2) Now please check your logs, either your error log, most likely or your access log, (the last entries should do it), & see what the error is that's being thrown. Please copy/paste that. My own suspicion is that it might be Nginx, but I'm not willing to go there quite yet.

You may also find it helpful to check the site health status on your WordPress dashboard to see if anything is amiss there.

looking forward to hearing from you soon.
 
Hi Abletec - I greatly appreciate your assistance.

I am not seeing anything under site heath - other than WordPress letting me know about having error reporting enabled, and not having imagick installed. I've also tried the Health Check & Troubleshooting plugin - but nothing reported there either. This one is really odd.

As far as logged errors - there are none that I am seeing, other than the route error mentioned above in Chrome. When attempting to save widgets - the error happens immediately which made me think it was potentially a firewall issue.

The access logs under the DA user account when the error occurs (updated for privacy) are the following. The last lines are when the error occurs.
Code:
123.123.123.123 - - [16/Nov/2022:17:02:08 -0500] "GET /wp-json/wp/v2/taxonomies?context=view&_locale=user HTTP/1.0" 200 1173 "https://www.domain.com/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:02:08 -0500] "GET /wp-json/wp/v2/taxonomies?context=view&_locale=user HTTP/1.0" 200 1173 "https://www.domain.com/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:02:08 -0500] "GET /wp-json/wp/v2/posts?context=edit&order=desc&orderby=date&per_page=5&_embed=wp%3Afeaturedmedia&_locale=user HTTP/1.0" 200 910 "https://www.domain.com/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:02:08 -0500] "GET /wp-json/wp/v2/categories?context=view&per_page=100&hide_empty=true&_locale=user HTTP/1.0" 200 910 "https://www.domain.com/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:02:08 -0500] "GET /wp-json/wp/v2/categories?context=view&per_page=100&_locale=user HTTP/1.0" 200 1171 "https://www.domain.com/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:03:07 -0500] "POST /wp-admin/admin-ajax.php HTTP/1.0" 200 812 "https://www.domain.com/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:04:07 -0500] "POST /wp-admin/admin-ajax.php HTTP/1.0" 200 812 "https://www.domain.com/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"
 
Last edited:
Here are the access logs when widgets are saved through the WordPress Customizer (i.e. Appearance > Customize > Widgets):

Code:
123.123.123.123 - - [16/Nov/2022:17:16:03 -0500] "GET /wp-json/wp/v2/taxonomies?context=view&_locale=user HTTP/1.0" 200 1173 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:04 -0500] "GET /wp-json/wp/v2/taxonomies?context=view&_locale=user HTTP/1.0" 200 1173 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:03 -0500] "GET /wp-json/wp/v2/users?context=view&per_page=100&has_published_posts%5B0%5D=post&_locale=user HTTP/1.0" 200 910 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:03 -0500] "GET /wp-json/wp/v2/types?context=view&_locale=user HTTP/1.0" 200 1431 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:05 -0500] "GET /wp-json/wp/v2/categories?context=view&per_page=100&hide_empty=true&_locale=user HTTP/1.0" 200 910 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:05 -0500] "GET /wp-json/wp/v2/categories?context=view&per_page=100&_locale=user HTTP/1.0" 200 1171 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:05 -0500] "GET /wp-json/wp/v2/posts?context=edit&order=desc&orderby=date&per_page=5&_embed=wp%3Afeaturedmedia&_locale=user HTTP/1.0" 200 910 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:07 -0500] "POST /?customize_changeset_uuid=ac4c58e5-fdee-4c8d-b8fb-c309f75e8223&customize_autosaved=on&customize_preview_nonce=c5b621891e HTTP/1.0" 200 1192 "https://www.domain.com/?customize_changeset_uuid=ac4c58e5-fdee-4c8d-b8fb-c309f75e8223&customize_theme=twentytwentyone&customize_messenger_channel=preview-0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:08 -0500] "POST /?customize_changeset_uuid=ac4c58e5-fdee-4c8d-b8fb-c309f75e8223&customize_autosaved=on&customize_preview_nonce=c5b621891e HTTP/1.0" 200 1193 "https://www.domain.com/?customize_changeset_uuid=ac4c58e5-fdee-4c8d-b8fb-c309f75e8223&customize_theme=twentytwentyone&customize_messenger_channel=preview-0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"

123.123.123.123 - - [16/Nov/2022:17:16:09 -0500] "POST /wp-admin/admin-ajax.php HTTP/1.0" 200 892 "https://www.domain.com/wp-admin/customize.php?return=/wp-admin/widgets.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0"
 
Last edited:
If anyone in the forum is hosting WordPress websites on Apache/NGINX, and has not updated their default http_methods in custombuild - this issue may also affect you. Anyone using a block based theme may be affected. DA's excellent support staff resolved the issue.

My configuration for http_methods was set to:

Code:
GET:HEAD:POST

This will prevent WordPress from saving Block Widgets through the default URL path (i.e. Dashboard > Appearance > Widgets). Update your setting using the following and the issue should be resolved:

Code:
# cd /usr/local/directadmin/custombuild

# ./build set http_methods ALL

# ./build rewrite_confs
 
Back
Top