码迷,mamicode.com
首页 > 其他好文 > 详细

自定义header参数时的命名要求

时间:2018-01-20 13:54:57      阅读:2438      评论:0      收藏:0      [点我收藏+]

标签:forward   clu   定义   包含   cores   local   默认   def   nbsp   

HTTP头是可以包含英文字母([A-Za-z])、数字([0-9])、连接号(-)hyphens, 也可义是下划线(_)。在使用nginx的时候应该避免使用包含下划线的HTTP头。主要的原因有以下2点。
1.默认的情况下nginx引用header变量时不能使用带下划线的变量。要解决这样的问题只能单独配置underscores_in_headers on。
2.默认的情况下会忽略掉带下划线的变量。要解决这个需要配置ignore_invalid_headers off。

 

 

http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  ‘$http_orig_client_ip - $remote_addr - $remote_user [$time_local] "$request" ‘
                      ‘$status $body_bytes_sent "$http_referer" ‘
                      ‘"$http_user_agent" "$http_x_forwarded_for"  "$upstream_addr" ‘;
    sendfile        on;
    underscores_in_headers on;
    ignore_invalid_headers  off;
    keepalive_timeout  65;
 upstream test2081{
    server 10.209.128.28:2081;
}

自定义header参数时的命名要求

标签:forward   clu   定义   包含   cores   local   默认   def   nbsp   

原文地址:https://www.cnblogs.com/gyfluck/p/8320294.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!