[英]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.