简体   繁体   English

ajax请求标头在开发服务器上具有内容类型application / json,但在生产环境中具有text / html

[英]ajax request header has content-type application/json on dev server but text/html on production

Running a Drupal website on a LAMP stack. 在LAMP堆栈上运行Drupal网站。 Using the Advanced Poll module , where votes and canceled votes are processed via ajax. 使用高级投票模块 ,其中的投票和已取消的投票通过ajax处理。

On my dev server this works just fine; 在我的开发服务器上,这很好。 on my production server, I get HTTP 500 error ( screenshot ). 在生产服务器上,我收到HTTP 500错误( 屏幕截图 )。

Looking at console headers output, I can see that the request is being sent by POST with content-type application/json on my dev server, but on my production server with content-type text/html and gzip content-encoding. 查看控制台头输出,我可以看到请求是通过POST以内容类型application / json在我的开发服务器上发送的,但是在我的生产服务器上是使用内容类型text / html和gzip content-encoding的发送的。

What the hell? 我勒个去? Other ajax requests from other modules are working just fine on both servers... 来自其他模块的其他ajax请求在两个服务器上都可以正常工作...

Compare these two screenshots: 比较这两个屏幕截图:

DEV SERVER 开发服务器

在此处输入图片说明

PRODUCTION SERVER 生产服务器

在此处输入图片说明

It is just mean that your application have some problem/issue on production server. 这仅表示您的应用程序在生产服务器上有问题/问题。 So application send default response type (text/html). 因此,应用程序发送默认响应类型(text / html)。 You need to check problems through web server logs or any other debug. 您需要通过Web服务器日志或任何其他调试来检查问题。 Remeber all server type error like 404, 500 or similar response type will be text/html until you override this through application 记住所有服务器类型错误(例如404、500或类似的响应类型)将是text / html,直到您通过应用程序覆盖此错误为止

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 标头Content-Type:application / json返回text / html - header Content-Type: application/json returning text/html `header(“Content-type:application / json”)的用法;` - The usage of `header(“Content-type:application/json”);` Ajax中的JSON字符串发布请求内容类型application / formdata与application / json - JSON string in ajax post request content-type application/formdata vs application/json 何时在PHP中使用标题('Content-Type:application / json') - When to use header('Content-Type: application/json') in PHP 为什么是header('Content-Type:application / json'); 在我们的网络服务中? - Why header('Content-Type: application/json'); in our web service? PHP header('Content-Type: application/json'); 不管用 - PHP header('Content-Type: application/json'); is not working Slim - 如何使用“Content-Type:application / json”标题发送响应? - Slim - How to send response with “Content-Type: application/json” header? 如果标题中的Content-Type是text / html,则重新加载图像 - Reload image if Content-Type in header is text/html 如何在此请求中添加Content-Type application / json - How to add Content-Type application/json in this request 未记录的PHP自动将content-type:application / json解码为$ _REQUEST - PHP undocumented automatically decode content-type:application/json to $_REQUEST
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM