Open bobbingwide opened 1 year ago
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
says
The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing).
Trace output of the request from my local client shows some more information extracted from the http_api_debug
hook
[http_response] => WP_HTTP_Requests_Response Object
[ * response] => Requests_Response Object
[body] => (string) ""
[raw] => (string) "HTTP/1.1 400 Bad Request
Server: nginx
Date: Tue, 23 Aug 2022 13:46:40 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 1
Connection: close
SG-F-Cache: BYPASS
X-Robots-Tag: noindex
X-Content-Type-Options: nosniff
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Referrer-Policy: strict-origin-when-cross-origin
X-Frame-Options: SAMEORIGIN
X-Httpd-Modphp: 1
Host-Header: 8441280b0c35cbc1147f8ba998a563a7
X-Proxy-Cache-Info: DT:1
0"
The access log on the server shows the 400
92.2.77.247 herbmiller.me - [23/Aug/2022:13:46:42 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 400 1 "https://herbmiller.me/wp-admin/admin-ajax.php" "WordPress/6.0.1; https://s.b/hm" | TLSv1.3 | 1.472 1.472 1.499 - 0 NC:000000 UP:-DT
And so does the Daily Trace Summary.
/wp-admin/admin-ajax.php,oik_clone_post,2.611299,8.0.22,2005,5192,1698,22,2013,45,21,12,87,,,,,16931,92.2.77.247,2.611229,2022-08-23T13:46:40+00:00,WordPress/6.0.1; https://s.b/hm,POST,400
I'd failed to notice these trace records during my original investigation.
Oops, turns out it was my mistake. oik-clone wasn't activated on the server. Now, whether or not that's a User Error is to be determined.
wp-admin/admin-ajax.php
{"narrative":null,"slave":0}
When there's a problem with the API key the server function oik_clone_validate_apikey()
could be changed to use
wp_die( "API key mismatch", 401 );
Note: 401 is Unauthorized. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
I received this error code when attempting to reclone a post from s.b/hm to herbmiller.me
Question: Why was request rejected with a 400?