REST API parameters not working with nginx
I’m having an issue with the server I’m working off of ignoring any parameters I send to the REST API. My local environment works perfectly, but for some reason the other environments don’t. I work with a DevOps team, so I’m trying to gather as much information as I can to pass on to them to help them fix the problem.
Examples of endpoints I’ve tried hitting:
/wp-json/wp/v2/posts?per_page=2
/wp-json/wp/v2/posts?post_status=publish&page=4&posts_per_page=1&filter[posts_per_page]=1
/wp-json/wp/v2/posts?filter[posts_per_page]=2
/wp-json/wp/v2/posts?page=1&per_page=1&filter[s]=blah
Regardless of the endpoint I’m trying to hit the Headers link that is always returned is
Link →<https://myurl.com/wp-json/wp/v2/posts?q&page=2>; rel="next"
I found this post about nginx configuration issues: http://v2.wp-api.org/guide/problems/#query-parameters-are-ignored and changed the try_files
line but the problem persists.
If anyone else has encountered this issue and has any tips for fixing it I would really appreciate it!
Leave an answer