AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[nginx-reverse-proxy](server)

Martin Hope
meilon
Asked: 2022-10-27 22:42:08 +0800 CST

nginx 不修改查询仅重定向反向代理

  • 5

我必须在 TLS 终止的 Web 服务前面放置一个 nginx 反向代理,它只使用 URI 的查询部分进行 302 重定向:

GET /path/to/document?query=1
Host: 127.0.0.1

Returns 302 with 
Location: ?query=2

nginx 总是构建完整的 URI 但忽略文档,因此重定向不起作用

GET /path/to/document?query=1
Host: example.com

Returns 302 with 
Location: https://example.com/path/to/?query=2

我试过了proxy_redirect off;,但这并没有改变任何东西。我究竟做错了什么?

这是我目前使用的配置:

location / {
    client_max_body_size 50M;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Ssl on;
    proxy_set_header X-Frame-Options SAMEORIGIN;
    proxy_pass http://ip.of.the.host/;
    proxy_redirect off;
}

我可以设置proxy_redirect ~\?(.*)$ https://example.com/path/to/document?$1;,但我确定我会破坏其他东西。

如何让 nginx 只回复与上游服务器相同的位置路径?

nginx nginx-reverse-proxy
  • 1 个回答
  • 18 Views
Martin Hope
Reza Kazemi
Asked: 2022-10-12 02:46:08 +0800 CST

Nginx 根据位置块重定向所有传入的请求

  • 0

我使用 Nginx 作为反向代理。我假设我有一个像 test.com 这样的域和一个像 /test 这样的路径的位置块。该位置将 proxy_pass 到另一个网站,例如http://test2.com。当我在浏览器上键入 URL 时,它会将第一个请求重定向到应用程序(http://test.com/test/ --> http://test2.com/)。但是,所有传入的请求都将在没有我在 Nginx 上定义的位置的情况下发送。如何使所有传入请求都遵循该路径?我想要这样的东西:

  • 第一个请求:http ://test.com/test/ --> http://test.com

  • 传入请求:http ://test.com/test/statifile.js

  • http://test.com/test/api/something等等...

    server {
     listen 80;
     charset utf-8;
     server_name test.com;
     location = /auth/test{
         internal;
         proxy_pass http://test.com/test/decisions/;
         proxy_pass_request_body off;
         proxy_set_header Content-Length '';
         proxy_set_header X-Original-URI $request_uri;
     }
     location = /test/decisions/ {
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $http_connection;
         proxy_set_header Authorization $http_authorization;
         proxy_pass http://valid.domain/test/api/authorization;
     }
     location /test/ {
         auth_request /auth/test;
         auth_request_set $auth_status $upstream_status;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header X-Forwarded-Proto $scheme;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $http_connection;
         proxy_set_header Authorization $http_authorization;
         proxy_pass https://test2.com/;
         proxy_pass_header Server;
         proxy_http_version 1.1;
         proxy_redirect default;
         access_log /var/log/nginx/access.log;
         client_max_body_size 10240M;
     }
    }
    
nginx nginx-reverse-proxy
  • 1 个回答
  • 21 Views
Martin Hope
MrTux01
Asked: 2022-02-21 12:31:20 +0800 CST

Nginx 查询字符串重写

  • 0

我有如下配置,但我收到 500 错误。这个错误可能在哪里?

upstream masterservers {server 192.168.1.1:8000;}
upstream slaveservers {server 192.168.1.2:8001;}

map $request_uri $redirect_to {
    "target=master"     masterservers;
    "target=slave"   slaveservers;
}

server {
    listen 80;
        server_name 192.168.1.10;

       location / {
        proxy_pass              http://$redirect_to;
    }

}

当我如下调用 URL 时,出现以下错误。

http://192.168.1.10/app/index.html?target=master

http://192.168.1.10/app/index.html?target=slave

Nginx 日志:*2 invalid URL prefix in "http://", client: 192.168.1.11, server: 192.168.1.10, request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.10", referrer: "http://192.168.1.10/app/index.html?target=master"

nginx nginx-reverse-proxy
  • 1 个回答
  • 62 Views
Martin Hope
Questi
Asked: 2022-02-17 07:54:22 +0800 CST

nginx Reverse-Proxy:使用流模块进行直通和反向代理

  • 0

我使用流模块来传递无法反向代理的 tls 流量,例如因为我没有证书(本地 3CX 安装)或者它破坏了东西(带有客户端证书的 ssl vpn)。然后我将“rest”转发到同一主机(127.0.0.1)上的不同 IP 以进行反向代理。问题是 remote_addr 并不总是 127.0.0.1 并且似乎没有办法设置“真实”远程地址。为了规避这一点,我启用了 proxy_protocol 并使用了 $proxy_protocol_addr。

然而,这打破了所有直通网站,我还没有找到一种方法来有条件地只为“默认”启用 proxy_protocol

我这样做是为了在 sni 上进行匹配,并为所有网站使用一个 IP。

我并没有完全以这种方式做事,如果有人知道如何以不同/更好的方式实现这一目标,我会全力以赴。

stream {
  map $ssl_preread_server_name $targetBackend {
    3cx.example.com  192.168.1.2:443;
    vpn.example.com  192.168.1.3:443;
    default  127.0.0.1:443;
  }
  server {
    listen 192.168.1.100:443;
    proxy_connect_timeout 1;
    proxy_timeout 3s;
    resolver 192.168.1.1;
    proxy_protocol on;
    proxy_pass $targetBackend;
    ssl_preread on;
  }

所以......如何使proxy_protocol有条件(如果只是在流上下文中不起作用)或以另一种方式解决它?

proxy nginx passthrough nginx-reverse-proxy stream
  • 1 个回答
  • 367 Views
Martin Hope
Cyanmodex9
Asked: 2022-02-14 04:46:00 +0800 CST

带有两台服务器的 nginx 反向代理 404

  • 0

我的 NGINX 配置有问题。我有两个在 Windows 服务器上运行的网络服务器。哪个是从外部调用的 443,然后应该转发到带有 41001 的服务器。第二个服务器块应该称为 FQDN,nginx 应该将它转发到 FQDN.com/test。内部和外部。

在第一个服务器块上,这需要永远加载,并且似乎没有任何效果。使用第二个服务器块,我得到了 404。

这是我的配置和错误日志的样子

server {
    server_name test.example.com;
    return 301 http://test.example.com/test$request_uri;
    }


server {
        listen  443 ssl http2;
        listen  [::]:443 ssl http2;
 
        access_log /var/log/nginx/test_service_access.log;
        error_log /var/log/nginx/test_service_error.log;

        ssl_certificate /etc/nginx/ssl/test.com.pem;
        ssl_certificate_key /etc/nginx/ssl/test.key;
        ssl_session_timeout 1d;
        ssl_session_tickets off;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-G>        ssl_prefer_server_ciphers off;

        location /test {
        proxy_pass https://10.10.10.10/test/;
        }

        client_max_body_size    0;
        proxy_connect_timeout   90s;
        proxy_send_timeout              90s;
        proxy_read_timeout              90s;
        send_timeout                    90;
    }

server {
        server_name test2.example.com;
        # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
        return 301 https://test2.example.com$request_uri;
}

server {
        listen  443 ssl http2;
        listen  [::]:443 ssl http2;
        server_name test2.example.com;

        access_log /var/log/nginx/test2_service_access.log;
        error_log /var/log/nginx/test2_service_error.log;

        ssl_certificate /etc/nginx/ssl/test2.example.com.pem;
        ssl_certificate_key /etc/nginx/ssl/test2example.key;

#       ssl_session_cache shared:SSL:50m;
        ssl_session_timeout 1d;
        ssl_session_tickets off;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-G>
        ssl_prefer_server_ciphers off;

        add_header Strict-Transport-Security max-age=15768000;

        location / {

#       resolver 10.150.10.10 8.8.8.8;
        proxy_pass https://test2.example.com:41001/;
        proxy_redirect  https://test2.example.com:41001/ https://test2.example.com/;

        client_max_body_size    0;
        proxy_connect_timeout   90s;
        proxy_send_timeout              90s;
        proxy_read_timeout              90s;
        send_timeout                    90;
        }
    }
}

我查看了error.logs,这就是出现的问题。

2022/02/13 12:54:58 [error] 2620#2620: *15 open() "/usr/share/nginx/html/DocuWare/Platform/LoginRedirect" failed (2: No such file or directory), client: xxx.xxx.xxx.xxx, server: , request: "GET /DocuWare/Platform/LoginRedirect?returnUrl=%2fdocuware%2fPlatform%2fWebClient%2f HTTP/2.0", host: "test2.domain.com", referrer: "https://test.domain.com/docuware/Platform/WebClient/"

2022/02/13 12:35:17 [error] 2541#2541: *1 upstream timed out (110: Connection timed out) while connecting to upstream, client:

关于第一个错误,我不明白到底是什么问题

据我了解,我需要为端口 41001 的服务器定义一个上游,对吗?

我在这里错过了什么吗?

更新

我已经将我的配置调整到最小,以便我可以测试它。如下我的配置看起来像这样

######################################################################
   upstream abacus {
      server 10.120.50.11; 
   }
   
   server {
      listen 80;
      server_name abacus.example.com;
      return 301 https://abacus.example.com$request_uri;
   }
    
   server {
      listen 443 ssl;
      server_name abacus.example.com;
      ssl_certificate /etc/nginx/ssl/xxx.com.pem;
      ssl_certificate_key /etc/nginx/ssl/xxx.key;
      ssl_protocols TLSv1.2 TLSv1.3;

      access_log /var/log/nginx/abacus_service_access.log;
      error_log /var/log/nginx/abacus_service_error.log;

   location / {
      proxy_pass http://abacus;
   }
}

#######################################################################
   upstream docuware {
      server 10.120.50.10; 
   }
   
   server {
      listen 80;
      server_name docuware.example.com;
      return 301 https://docuware.example.com$request_uri;
   }
   
   server {
      listen 443 ssl;
      server_name docuware.example.com;
      ssl_certificate /etc/nginx/ssl/xxx.pem;
      ssl_certificate_key /etc/nginx/ssl/xxx.key;
      ssl_protocols TLSv1.2 TLSv1.3;

      access_log /var/log/nginx/docuware_service_access.log;
      error_log /var/log/nginx/docuware_service_error.log;
      
   location / {
      proxy_pass http://docuware/docuware;
   }
}
}

当我访问服务器“abacus.example.com”时,我进入了 IIS 主页。所以在这里我必须定义我来自外部的 443 (HTTPS) 并且我被重定向到端口 23001。

如果我访问服务器“docuware.example.com/docuware”,我会收到 404 - 找不到文件或目录。所以在这里我必须以某种方式定义它可以使用子路径访问服务器。

在内部网络中,这可以正常工作。我被重定向到“docuware.example.com/DocuWare/Platform/WebClient/ClientAccount/xxx”。

你看到这里我需要调整什么了吗?几个小时以来,我一直在努力反对它。

log-files nginx nginx-reverse-proxy iis-8.5 external-connection
  • 2 个回答
  • 563 Views
Martin Hope
Honza Zidek
Asked: 2022-02-10 09:23:55 +0800 CST

是否可以使用 *header name* 的变量在 NGINX 中设置代理标头?

  • 0

根据NGINX 文档

proxy_set_header field value允许重新定义或附加字段到传递给代理服务器的请求标头。该值可以包含文本、变量及其组合。

所以我可以

set $my_variable "some_value";
proxy_set_header x-my-header $my_variable;

无论如何可以为field参数使用变量,即标题名称基于变量吗?我希望能够像配置 NGINX

set $my_variable "x-my-header";
proxy_set_header $my_variable "some_value";
configuration nginx reverse-proxy nginx-reverse-proxy
  • 1 个回答
  • 656 Views
Martin Hope
ProGamer1
Asked: 2022-02-09 19:14:11 +0800 CST

使用 Nginx 作为网络服务器和反向代理导致问题

  • 0

我正在尝试将 Nginx 设置为 wordpress 的网络服务器和反向代理,以同时为 pihole(使用 lighttpd)和各种其他服务器提供服务。但是,配置后,我遇到了一个奇怪的问题。当我将reverse-proxy.conf文件放在我的站点sites-enabled文件夹中时,直接访问该 IP 地址只会显示默认的 Nginx 欢迎页面。但是,当我取消链接时reverse-proxy.conf,会出现 wordpress。我在这里做错了什么?

nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

默认

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/wordpress;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html index.php;

    server_name _;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    #
    #   # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    #   # With php-cgi (or other tcp sockets):
    #   fastcgi_pass 127.0.0.1:9000;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

反向代理.conf

 server {
  #replace Xs below with your IP
  listen 192.168.1.29:80;
   location /pihole/ {
   allow 192.168.1.0/24;
   deny all;
   proxy_pass http://192.168.1.29:82/admin/;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For 
   $proxy_add_x_forwarded_for;
   proxy_read_timeout 90;
  }
}
nginx nginx-reverse-proxy
  • 1 个回答
  • 54 Views
Martin Hope
mlazzarotto91
Asked: 2022-02-02 13:10:20 +0800 CST

Nginx 代理管理器 proxy_pass 不起作用

  • 0

在 Nginx 代理管理器上,我有这个配置(名称已编辑)

# ------------------------------------------------------------
# www.lab.myself.it
# ------------------------------------------------------------


server {
  set $forward_scheme http;
  set $server         "127.0.0.1";
  set $port           81;

  listen 80;
listen [::]:80;

  server_name www.lab.myself.it;

  access_log /data/logs/proxy-host-2_access.log proxy;
  error_log /data/logs/proxy-host-2_error.log warn;

  location /wiki/ {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_set_header X-Real-IP          $remote_addr;
    proxy_pass       http://maersk.lab.myself.it:8181/;

  }

  location / {
    # Proxy!
    include conf.d/include/proxy.conf;
  }

  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}

理想情况下,我应该能够浏览到http://www.lab.myself.it/wiki并且 Nginx 应该将我发送到http://maersk.lab.myself.it:8181。

问题是我得到了一个简单的网页,因为浏览器无法加载 CSS、JS 或图像。当我尝试单击 wiki 上的链接时,它会将我带到http://www.lab.myself.it/documentation <-- MISSING THE /WIKI/

nginx-reverse-proxy
  • 1 个回答
  • 747 Views
Martin Hope
Shaunak
Asked: 2022-01-25 12:31:54 +0800 CST

如何使用 Nginx 反向代理特定的扩展名

  • 0

假设我正在尝试代理所有对 jpg、png 和 mp3 文件的请求,如下所示:

http://example.com/some/url/file.png

至

http://example.net/data/some/url/file.png

请注意,它与另一台服务器的路径完全相同,但添加了数据。

她是我目前所拥有的:

location ~* .(jpg|png|mp3)$ {
        proxy_pass https://example.net/data/;
        proxy_redirect https://example.net/data/ /
    }

但是我不断收到错误

"proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block

出了什么问题,如何正确编写此位置块?

nginx nginx-reverse-proxy
  • 1 个回答
  • 235 Views
Martin Hope
Aquarion
Asked: 2022-01-22 09:00:50 +0800 CST

代理时如何让 nginx 不覆盖 x-forwarded-for?

  • 3

我在负载均衡器后面有一个 nginx 服务器,nginx 服务器将请求传递给各种服务,但在本例中是一个运行 apache 的 docker 容器。负载均衡器正确设置了 X-Forwarded-For,但是当它到达 docker 容器时,X-Forwarded-For 已设置为 LB IP。

我在 nginx 配置中有这个:

/etc/nginx/conf.d/real_ip.conf
set_real_ip_from {{LB IP}};
real_ip_header X-Real-IP;
real_ip_recursive on;

这是虚拟主机:

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name *.domain domain;
    include /etc/nginx/snippets/domain_ssl.conf;

  add_header X-Nginx-Debug "hi";

  proxy_pass_request_headers on;

  location    / {
    proxy_pass_request_headers on;
    proxy_pass  http://container-php;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Remote-Addr $remote_addr;
    proxy_set_header X-Real-IP $http_x_real_ip;
    proxy_set_header X-Header-Test "Hello World - $http_x_forwarded_for";
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

但我从容器中得到的是:

array(19) {
  ["Connection"]=>
  string(7) "upgrade"
  ["Host"]=>
  string(19) "domain"
  ["X-Forwarded-For"]=>
  string(12) "{{LB IP}}"
  ["X-Header-Test"]=>
  string(13) "Hello World -"
  ["X-Forwarded-Proto"]=>
  string(5) "https"
  ["cache-control"]=>
  string(9) "max-age=0"
  ["sec-ch-ua"]=>
  string(64) "" Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97""
  ["sec-ch-ua-mobile"]=>
  string(2) "?0"
  ["sec-ch-ua-platform"]=>
  string(9) ""Windows""
  ["upgrade-insecure-requests"]=>
  string(1) "1"
  ["user-agent"]=>
  string(114) "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
  ["accept"]=>
  string(135) "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
  ["sec-fetch-site"]=>
  string(4) "none"
  ["sec-fetch-mode"]=>
  string(8) "navigate"
  ["sec-fetch-user"]=>
  string(2) "?1"
  ["sec-fetch-dest"]=>
  string(8) "document"
  ["accept-encoding"]=>
  string(17) "gzip, deflate, br"
  ["accept-language"]=>
  string(26) "en-GB,en-US;q=0.9,en;q=0.8"
}

值得注意的是 X-Real-IP、X-Fowarded-For 似乎没有设置,remote_addr 也没有。直接从 nginx 提供的文件已正确设置 x-forwarded-for,因此 LB 正在发送正确的标头。

我错过了一步吗?

nginx reverse-proxy nginx-reverse-proxy
  • 4 个回答
  • 4742 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve