Syntax: | underscores_in_headers |
---|---|
Default: | underscores_in_headers off; |
Context: | http , server |
Enables or disables the use of underscores in client request header fields. When the use of underscores is disabled, request header fields whose names contain underscores are marked as invalid and become subject to the ignore_invalid_headers directive.
If the directive is specified on the server level, its value is only used if a server is a default one. The value specified also applies to all virtual servers listening on the same address and port.
但是nginx為什么要加這個(gè)配置呢,查找資料有的說HTTP Header name不能包含下劃線。
翻了翻HTTP RFC,好像沒有這個(gè)要求。
3.2 Header Fields
Each header field consists of a case-insensitive field name followed by a colon (":"), optional leading whitespace, the field value, and optional trailing whitespace.
header-field = field-name ":" OWS field-value OWS
field-name = token
token的范思科表達(dá)式定義:
token = 1*tchar
tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA ; any VCHAR, except delimiters
Delimiters are chosen from the set of US-ASCII visual characters not allowed in a token (DQUOTE and "(),/:;<=>?@[\]{}").
如果沒理解錯(cuò)的話,HTTP header name應(yīng)該可以包含下劃線的。
還是下劃線在nginx里有特殊用途,好像有的說是cgi會(huì)用到。