当前位置: 代码迷 >> 综合 >> nginx隐藏x-real-ip头配置
  详细解决方案

nginx隐藏x-real-ip头配置

热度:95   发布时间:2023-12-12 02:27:43.0

实现隐藏X-Real-Ip头,可通过配置server{} proxy_set_header实现。

server {

        listen  10.10.98.10:8080 backlog=20480;

        proxy_set_header  Host $http_host;

        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header  X-Forwarded-Proto $scheme;

        proxy_set_header  X-Forwarded-Port $remote_port;

        proxy_set_header  X-Real-Ip "";

        proxy_http_version  1.1;

        limit_req  zone=req5k burst=1000;

        location / {

            proxy_pass  http://up_10_10_98_10_8080;

            session_sticky_hide_cookie  upstream=up_10_10_98_10_8080;

        }

    }