自定義header參數時的命名要求
阿新 • • 發佈:2018-01-20
劃線 remote 參數 sta clu nor invalid forward sendfile
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參數時的命名要求