FortAwesome / wordpress-fontawesome

Font Awesome Official WordPress Plugin
Other
56 stars 19 forks source link

Add PUT verb requirement to documentation #81

Closed mlwilkerson closed 3 years ago

mlwilkerson commented 4 years ago

In a few cases, users have reported that the plugin can't save changes. There are a range of root causes that have led to this, but they all have to do with unexpected server conditions which result in this plugin's browser code (the admin React app) from being able to communicate with the back end code via the WordPress REST API.

One of those reasons has been some web servers not configured to allow the PUT HTTP verb. I've seen this at least a couple of times on IIS servers, in particular.

This may result in a 405 Method Not Allowed error.

In the modern era of WordPress, with Gutenberg--the default editor--relying entirely on the REST API, it should be standard that web servers allow the PUT verb. The usage docs on wordpress.org indicate that POST should be used for creating new resources while PUT should be used for updating resources. That's standard for REST APIs, but the world may still be catching up with the increasing reliance of WordPress core, and plugins like ours, on the WordPress REST API and related server configuration requirements. So it makes sense that some web servers may not yet be allowing the PUT verb by default for WordPress installs.

Let's add a note to our docs about it.

mlwilkerson commented 3 years ago

Closing this. After looking more closely at this, the JavaScript console reporting seems adequate. And this detail doesn't seem like the kind of thing someone would see and notice and register if it were in the readme. When simulating this error in local dev, the JS console shows:

Font Awesome WordPress Plugin Error Report
reportRequestError.js:145 WARNING: The last response from your WordPress server did not include the confirmation header that should be in all valid Font Awesome responses. This is a clue that some code from another theme or plugin is acting badly and causing the wrong headers to be sent.
reportRequestError.js:149 WARNING: Invalid Data Trimmed from Server Response
reportRequestError.js:153 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method PUT is not allowed for this URL.</p>
<hr>
<address>Apache/2.4.38 (Debian) Server at wp.test Port 8765</address>
</body></html>

So it seems clear enough already.