proxy_set_header 属性说明

物理机的访问的ip:221.221.1.100

对外开放的外网ip:200.200.19.53

nginx:10.30.30.109:8314

代理后台服务的ip:10.30.30.131:8080

server{
        listen 8314;
        server_name 200.200.19.53;
        #server_name 10.30.30.109;
        location /jettech {
                 proxy_pass http://10.30.30.131:8080;
                 proxy_pass_request_headers  off;
                 proxy_cache_valid  200 206 304 301 302 10d;
                 proxy_cache_key $uri;
                 proxy_ignore_headers Set-Cookie Cache-Control;
                 proxy_hide_header Cache-Control;
                 proxy_hide_header Set-Cookie;
                 proxy_set_header   proxy_nginx_ip   $host; #server_name of ip,200.200.19.53
                 proxy_set_header   X-Real-IP_Client_Access  $remote_addr; #access clint host or yourself of ip。用户访问的时候的自己电脑ip地址221.221.1.100
                 proxy_set_header   X-Real-Port_Client_Access  $remote_port; #access clint port。用户访问的时候的自己电脑端口,随机分配动态变化
                 proxy_set_header   X-Real-User_Client_Access  $remote_user ; #access clint user。客户的用户名
                 proxy_set_header   X-Referer $http_referer;
                 proxy_set_header   Cookie $http_cookie;
                 proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for; #all access client ip 。从客户访问到到最后的后台服务所经理的所有节点的ip汇总221.221.1.100,10.30.30.109,...
                 proxy_set_header   X-FORWARDED-HOST $server_addr; #nginx of ip 10.30.30.109
                 proxy_set_header   proxy_nginx_hostname  $hostname; # nginx of hostname,k8s-test-nginx-109
                 proxy_set_header   X-FORWARDED-PORT $server_port; #nginix of port or nginx listen of port,8314
                 proxy_set_header   X-FORWARDED-NAME $server_name; #serve_name of ip or $host
                 proxy_set_header   X-FORWARDED-PROTO $server_protocol;
                 proxy_set_header   X-NGINX_VER $nginx_version;
                 proxy_set_header   Proxy_Host $proxy_host; #proxy_pass of ip or houtai server of ip ,要转发的地址10.30.30.131(proxy_pass http://10.30.30.131:8080;)
                 proxy_set_header   Proxy_Port $proxy_port; #proxy_pass of port ou houtai server of port,要转发的端口8080(proxy_pass http://10.30.30.131:8080;)
                 proxy_http_version 1.1;
                 #开启对http1.1支持
                 proxy_set_header Connection "";
                 # 设置Connection为空串,以禁止传递头部到后端
                 # http1.0中默认值Connection: close
                 proxy_redirect                      off;
                 #proxy_pass http://10.30.30.131;
                }
        }

你可能感兴趣的:(proxy_set_header 属性说明)