WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 10 months ago

#45074 new defect (bug)

Unable to use rest api if it has a query "?" in the url on Nginx. Gives "{"code":"rest_no_route","message":"No route was found matching the URL and request method","data":{"status":404}"

Reported by: instanceid Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.8
Component: REST API Keywords:
Focuses: Cc:
PR Number:

Description

This is a follow-up to #39432.

Hello,
I am not sure if it is exactly related to the mentioned ticket, but I am having the exact same symptoms. I have scoured the internet for 2 days straight reading everything and trying everything I could try but I always end up with the same result.

If I hit :

/wp-json/wp/v2/users/

It is just fine (most everything is for that matter), but as soon as I try to hit :

wp-json/wp/v2/users?=

Or anything involving a query string I get the error of :

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

The two plugins I am using WP REST API - OAuth 1.0a Server as well as Advanced Access Manager. If anyone has any insight to this, I would be greatly appreciative.

Thanks,

Change History (2)

#1 in reply to: ↑ description @instanceid
12 months ago

I tried to edit my post but could not seem to find the option to. I wanted to add that I have tried several things that other people have mentioned that have worked for them, such as using "?json_route=/posts?filters[s]=something" in place of /wp-json/ but unfortunately that doesn't seem to make any sort of difference, either using permalinks or not.

#2 @strangerstudios
10 months ago

I have not been able to recreate this.

I have a local environment using Local by Flywheel. It is running PHP 7.2.9, WP 5.0, and Nginx (not sure the version).

I activated Advanced Access Manager v5.7.1 and WP OAuth Server v3.6.0 but did not change any of the default settings for those.

When I visit /wp-json/wp/v2/users?= or /wp-json/wp/v2/users?=j in a browser, I am returned the json for the one user on my site. When I visit those URLs while logged out, I get an empty set.

Does this only happen when authenticating through OAuth? Are there settings for OAuth or AAM that are involved. Does this still happen in WP 5.0?

Note: See TracTickets for help on using tickets.