Magento API fails in a CGI env (zf1 issue)
curl -X POST "http://magento.local/index.php/rest/V1/integration/customer/token" -H "Content-Type:application/json" -d '{"username":"user@local", "password":"pass"}'
{"message":"Content-Type header is empty."}
When php is run as (Fast)CGI (issue seen using php-fpm), some HTTP headers can't be found.
Relevant code is in https://github.com/magento/magento2/blob/master/app/code/Magento/Webapi/Controller/Rest/Request.php#L149
The issue lies with ZF1 failing to find the Content-Type header when there is no Apache Env.
Filed a patch upstream, at https://github.com/zendframework/zf1/pull/477
We are currently looking into this issue and will keep you posted with the updates. Thanks for providing the zf patch!
Thanks for fixing! Will verify and close then.
Looking good and Working here.
Closing this. :stamp_of_approval:
Reopening this for a potentially "more proper" fix now committed to ZF1, https://github.com/zendframework/zf1/pull/484 This upstream change may or may not clash (I haven't properly looked) with the change done in Magento's codebase, if this zf1 update eventually gets pulled into magento's fork.
Just a heads up. Feel free to close, please.
Thanks @nyov for the updated fix . We have an internal issue to address this : MAGETWO-31613. We will keep you posted when the fix is applied.
@nyov We have gone ahead and upgraded to zf 1.12.10 (instead of just taking in the patch) in 0.42.0-beta8. https://github.corp.ebay.com/magento-folks/magento2ce/blob/M2-GitHub-Update-0.42.0-beta8/composer.json#L32 This should take care of the issue you reported. Closing it. Thank you for your contribution!