使用Nginx代理从监听器获取真实IP

问题描述 投票:0回答:1

我尝试使用Nginx制作代理Icecast / Shoutcast广播,并从监听器获取真实IP。

如果我输入localhost ip

location /exampleradio/ {
    proxy_buffering           off;
    proxy_ignore_client_abort off;
    proxy_intercept_errors    on;
    proxy_next_upstream       error timeout invalid_header;
    proxy_redirect            off;
    proxy_connect_timeout     60;
    proxy_send_timeout        21600;
    proxy_read_timeout        21600;

    proxy_set_header Host 127.0.0.1:8000;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;

    proxy_pass http://127.0.0.1:8000;
}

正确显示的侦听器ip,

当我从另一个服务器示例放另一个广播时:

location /exampleradio1/ {
    proxy_buffering           off;
    proxy_ignore_client_abort off;
    proxy_intercept_errors    on;
    proxy_next_upstream       error timeout invalid_header;
    proxy_redirect            off;
    proxy_connect_timeout     60;
    proxy_send_timeout        21600;
    proxy_read_timeout        21600;

    proxy_set_header Host cast.example.com:8000;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;

    proxy_pass http://cast.example.com:8000;
}

另一个服务器上的侦听器ip,它显示服务器ip,没有侦听器ip。我该如何解决这个问题,并获得监听器IP和无服务器IP?

谢谢。

nginx proxy listener icecast shoutcast
1个回答
0
投票

唯一支持“ X-Forwarded-For”标头的服务器是Icecast-kh。

切换到Icecast-kh,保持您的Nginx配置不变,不要忘记添加

<x-forwarded-for>_PROXY IP HERE_</x-forwarded-for>

至您的Icecast-kh配置。

© www.soinside.com 2019 - 2024. All rights reserved.