Opened 8 years ago
Last modified 5 years ago
#39889 new defect (bug)
Improve/Fix REST Response on Multisite when an endpoint for a non-existent site is hit.
Reported by: | nerrad | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | needs-patch needs-unit-tests |
Focuses: | multisite, rest-api | Cc: |
Description
Currently if you hit the endpoint for a domain on a site that doesn't exist it will behave the same as on a normal request.
- visit https://nonexistentsubdomain.eventsmart.com/wp-json in a REST client.
- Take note of the "Location" header in the response: https://eventsmart.com/wp-signup.php?new=nonexistentsite. It's also returned with a HTTP 302
Granted this is kind of edgecase, but I think it'd be better to handle things a bit better on REST requests. The question is how? I think from the standpoint of the REST client it'd be better to just return a 404 and a "site doesnt' exist" message (or something to that affect).
Change History (3)
Note: See
TracTickets for help on using
tickets.
I am +1 on fixing this - the REST API should return a JSON 404 in the same style as the rest of our
WP_Error
responses.The question is how. May be tricky depending on how early the current 404 is returned.