nginx标头变量在标头名称中转义特殊字符

我想在nginx.conf中读取其中包含“-”的标题

x-foo-bar

使用$http_name

$http_x-foo-bar变量的值变为“ -foo-bar”

看起来像是试图找到名为x的标头,然后将-foo-bar附加到值

有什么办法可以逃脱这些“-”

我试过了/但是
$http_x / -foo / -bar给出/ -foo / -bar的值
最佳答案
根据the documentation:

a variable name is the field name converted to lower case with dashes
replaced by underscores

尝试:

$http_x_foo_bar

dawei

【声明】:淮南站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。