• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Nginx 400 bad request with api call (php curl)

Erwan

Regular Pleskian
Hi all,

We have a problem when we call an api with php curl: it works when the call is from our local server but if the call is from the same server (developpment website in our case) on the same server, we have this nginx error: 400 bad request nginx.
When we use the url directly like a website, it works.

Do you have an idea? A problem with a nginx conf?
We don't have change anything from plesk default.

We try to reproduce the problem with this command:
#curl --v -H "Host:" https://mydomain.com/export"

Result:
* About to connect() to mydomain.com port 443 (#0)
* Trying x.x.x.x...
* Connected to mydoman.com (x.x.x.x) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=mydomain.com
* start date: août 25 08:13:08 2019 GMT
* expire date: nov. 23 08:13:08 2019 GMT
* common name: mydomain.com
* issuer: CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US
> GET /export HTTP/1.1
> User-Agent: curl/7.29.0
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Server: nginx
< Date: Thu, 17 Oct 2019 10:12:17 GMT
< Content-Type: text/html
< Content-Length: 150
< Connection: close

An idea?
 
Back
Top