• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

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