magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Magento API fails in a CGI env (zf1 issue)

Open nyov opened this issue 11 years ago • 6 comments

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

nyov avatar Dec 09 '14 02:12 nyov

We are currently looking into this issue and will keep you posted with the updates. Thanks for providing the zf patch!

ghost avatar Dec 10 '14 17:12 ghost

Thanks for fixing! Will verify and close then.

nyov avatar Dec 18 '14 04:12 nyov

Looking good and Working here.

Closing this. :stamp_of_approval:

nyov avatar Dec 18 '14 10:12 nyov

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.

nyov avatar Jan 03 '15 22:01 nyov

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.

anupdugar avatar Jan 23 '15 20:01 anupdugar

@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!

anupdugar avatar Feb 13 '15 16:02 anupdugar