underscores_in_headers on;     在http或者server下开启header的下划线支持:nginx默认不支持header中的下划线的

$http_{headerNane};  把{headerName}替换成你的真实headerName就可以了

proxy_set_header TestHeaderName testHeaderValue 在header中设置一个http的header内容

实例这是一个正向代理服务器的内容:

server {
     listen  8080;
     
     # dns resolver used by forward proxying
     resolver  114.114.114.114;
     # forward proxy for CONNECT request
     proxy_connect;
     proxy_connect_allow            443;
     proxy_connect_connect_timeout  10s;
     proxy_connect_read_timeout     10s;
     proxy_connect_send_timeout     10s;
     # more_clear_input_headers  test;
     underscores_in_headers  on;
     
    
    location / {
    
         proxy_pass http://$host;
         proxy_set_header Host $host;
#设置一个test的header值为header中的token proxy_set_header TEST $http_token; #more_clear_input_headers proxy
-token; } }

 

posted on 2020-11-06 10:53  张释文  阅读(832)  评论(0编辑  收藏  举报