WordPress.org

Make WordPress Core

Opened 14 months ago

Closed 5 weeks ago

#45074 closed defect (bug) (invalid)

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: Priority: normal
Severity: normal Version:
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 (3)

#1 in reply to: ↑ description @instanceid
14 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
12 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?

#3 @TimothyBlynJacobs
5 weeks ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 4.9.8 deleted

Hi @instanceid,

I'm going to close out this ticket. It looks to be a compatibility issue with your NGINX config. If you are still experiencing this issue, I'd recommend checking with the WordPress.org Support Forums or the WordPress Stack Exchange.

Note: See TracTickets for help on using tickets.