客戶端在請求時在http請求的header中加入了一些自定義參數(shù),但是以net_,os_,device_開頭的一些參數(shù)在后端無法獲取到。后端使用的 php,打印$_SERVER沒有這些參數(shù)
看了http協(xié)議和cgi協(xié)議也沒有找到相關(guān)說明
不太明白怎么回事
3 回答

尚方寶劍之說
TA貢獻(xiàn)1788條經(jīng)驗 獲得超4個贊
找到原因了
不只是net_
,os_
,device_
開頭的一些參數(shù),默認(rèn)情況下nginx會自動drop所有帶下劃線的header
需要設(shè)置 underscores_in_headers on;
If you do not explicitly set underscores_in_headers on;
, nginx will silently drop HTTP headers with underscores (which are perfectly valid according to the HTTP standard). This is done in order to prevent ambiguities when mapping headers to CGI variables, as both dashes and underscores are mapped to underscores during that process.
- 3 回答
- 0 關(guān)注
- 629 瀏覽
添加回答
舉報
0/150
提交
取消