• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

API Requests are Turned into GET Requests?

Patrick B

New Pleskian
This is a bug, right? A POST request to /wp-json/... should stay a POST request. ^^

To reproduce:
- Click the "send" button on a contact form 7 form. (Contact Form 7)
- right before clicking it, edit index.php to ' echo $_SERVER['REQUEST_METHOD'];'
It shows "GET" but the API request is clearly "POST" (dev tools says so, for example).

Here is the bad code:
/var/www/vhosts/system/DOMAIN.com/conf/nginx.conf
set $sef_entry_point /;
if ($uri ~* "^/") {
set $sef_entry_point "//index.php?$args";
}
error_page 404 = $sef_entry_point;
Without rewrites (i.e. with URLs like xyz.com?post_id=xxx or whatever), it stays "POST" since there it uses index.php?some_stuff...the_api_path so that no 404 is caused (see code below).
But with rewrites, this code turns it into GET, right? Unless custom permalinks are off (as said above), anyway.

I fixed it with my own code in the text input in the Plesk interface:
location /wp-json {
rewrite .* /index.php?$args;
}
Any thoughts on that?

Product version: Plesk Obsidian 18.0.27.1
OS version: Ubuntu 16.04 x86_64
Build date: 2020/05/22 12:00
Revision: 483fda892f6e4798504dcbd3348a557a7336d525

toolkit version - don't know how to find that one out
 
Back
Top