Nginx removes post data with content-type header

Solution 1:

I doubt this is Nginx's doing. Try

curl -H 'Content-Type: application/json' -d 'names=[{"name":"name"}]' 'http://localhost/api.php'

PHP does receive the json data, but the only way I could retrieve it, was

    $json = file_get_contents('php://input');
    var_dump($json);

which gave

string(23) "names=[{"name":"name"}]"

Even phpinfo() would not show the data, only the headers type and content size.

I had forgotten about GeekForGeeks howto