[wp-trac] [WordPress Trac] #54807: URL Details request returns a 404 status for inaccessible pages

WordPress Trac noreply at wordpress.org
Thu Jan 13 02:48:24 UTC 2022

#54807: URL Details request returns a 404 status for inaccessible pages
 Reporter:  talldanwp     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
 When the new URL details endpoint is called with a URL that doesn't exist
 or is inaccessible, it returns a 404 status.

 I'm not sure that this is correct. The 404 indicates that the URL Details
 endpoint itself isn't present. But that's not true, the URL Details
 endpoint did receive the request and responded, but instead the URL it was
 trying to access was not found.

 My feeling is this information about the missing or inaccessible page that
 the user requested details on should instead be returned via the url
 details response payload along with a success code. Another good reason
 for this is that browsers log 404 responses to the console as an error. To
 anyone looking, it seems as though WordPress has errors, but in fact the
 website is behaving correctly.

 I might be incorrect in my interpretation, so look forward to the
 discussion on this. Another consideration is that maybe it's too late to
 address this now, as it would likely be a breaking change.

 **Steps to reproduce:**
 1. Open the Gutenberg editor and open dev tools to the network tab
 2. Add the navigation block and choose Start Empty
 3. Click the + button in the navigation block
 4. When the URL Popover shows, type in the name of a page that you want to
 5. Click the 'Create draft page' option that shows up in the search
 6. In the network tab, observe the 404. This is because the draft that URL
 Details attempted to get details for was publicly inaccessible. However
 the 404 seems to indicate that URL Details itself can't be found.

Ticket URL: <https://core.trac.wordpress.org/ticket/54807>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list