Magento API 错误:已中止:解析标头时出错:重复标头“Content-Type”;
我刚刚将我的服务器升级到 PHP 5.3 和 Fast CGI。不幸的是,这导致magento api返回一个奇怪的错误
中止:错误解析标头:重复标头'Content-Type'
我已经尝试了Magento论坛的各种建议,但无济于事。
我正在运行 1.4.0.1。关于如何解决这个问题有什么建议吗?
I just upgraded my server to PHP 5.3 and Fast CGI. Unfortunately that caused the magento api to return a strange error
aborted: error parsing headers: duplicate header 'Content-Type'
I've tried various suggestions from the Magento fourms to no avail.
I'm running 1.4.0.1. Any suggestions to how to reconcile this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
来自 http://www.magentocommerce.com/boards/v/viewthread/229253/< /a>
编辑
使用以下代码 并替换 sendHeaders() 函数
(你不应该覆盖核心类,但这会让它工作。使用 app/code/local/Mage/... 不起作用,因为它是一个控制器)
From http://www.magentocommerce.com/boards/v/viewthread/229253/
Edit
and replace the sendHeaders() function with the following code
(You're not supposed to override core classes, but this will get it working. Using app/code/local/Mage/... doesn't work because it is a controller)
您使用什么网络服务器?
检查您的 Apache/nginx - fcgi 是否配置为默认发送此标头。
What webserver are you using?
Check if your Apache/nginx - fcgi is configured to send this header by default.
试试这个 - 按名称删除
并添加您的标题
Try this - remove by name
and add your header
我见过一些 Magento 和 fcgi 出现问题的网站。通常是因为 fast cgi 默认配置为发送标头。不过 mod_php 不会出现这个问题。大多数时候我都遇到过 Ajax 请求的问题。
我最终修复了 json 响应:
从
到
添加参数
true
将确保setHeader()
方法搜索标头数组并取消设置之前具有相同名称的任何标头它设置第二个标头。I've seen a few sites which have troubles with Magento and fcgi. Usually because fast cgi is configured to send a header by default. The problem doesn't occur with mod_php though. Most of the time I've experienced the issue with an Ajax request.
I ended up fixing the json response:
From
To
Adding the parameter
true
will make sure thesetHeader()
method searches the array of headers and unset any headers with the same name before it sets a second header.