如何修复 nginx 在任何标头测试工具上抛出 400 个错误的请求标头? [英] How to fix nginx throws 400 bad request headers on any header testing tools?

查看:22
本文介绍了如何修复 nginx 在任何标头测试工具上抛出 400 个错误的请求标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站使用 nginx,测试网站使用标头测试工具,例如http://www.webconfs.com/http-header-check.php但是每次它说下面的 400 个错误请求时都是该工具的输出.虽然我的所有页面在浏览器中都加载得很好,但当我在 chrome 控制台中看到它显示状态代码 200OK.

I have my site which is using nginx, and testing site with header testing tools e.g. http://www.webconfs.com/http-header-check.php but every time it says 400 bad request below is the out put from the tool. Though all my pages load perfectly fine in browser and when I see in chrome console it says status code 200OK.

HTTP/1.1 400 Bad Request => 
Server => nginx
Date => Fri, 07 Sep 2012 09:40:09 GMT
Content-Type => text/html
Content-Length => 166
Connection => close

我真的不明白我的服务器配置有什么问题?

I really don't understand what is the problem with my server config?

一些谷歌搜索建议使用增加缓冲区大小,我将其增加到以下内容:

A bit of googling suggests to increase the buffer size using, and I increased it to following:

large_client_header_buffers 4 16k;

同样的结果仍然存在.

有人能指引我走向正确的方向吗?

Can some one guide me to the right direction?

推荐答案

正如 Maxim Dounin 在 以上评论:

As stated by Maxim Dounin in the comments above:

当 nginx 返回 400 (Bad Request) 时,它会将原因记录到错误中日志,在信息"级别.因此,一个显而易见的方法来找出发生了什么是配置error_log在信息"级别记录消息并查看错误日志测试.

When nginx returns 400 (Bad Request) it will log the reason into error log, at "info" level. Hence an obvious way to find out what's going on is to configure error_log to log messages at "info" level and take a look into error log when testing.

这篇关于如何修复 nginx 在任何标头测试工具上抛出 400 个错误的请求标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆