代理从监听器获取真实

代理从监听器获取真实

本文介绍了使用 nginx 代理从监听器获取真实 ip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 nginx 制作代理 icecast/shoutcast 广播并从听众那里获得真实的 ip.

I try to make proxy icecast/shoutcast radio with nginx and get real ip from listener.

如果我输入localhost ip

If i put 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,

the listener ip it shows correctly,

当我从另一个服务器上放另一个收音机时:

When i put another radio from another server example:

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?

the listener ip on another server it shows the server ip and no listener ip.How can i solve this and get listener ip and no server ip?

谢谢.

推荐答案

唯一支持X-Forwarded-For"标头的服务器是 Icecast-kh.

The only server that supports "X-Forwarded-For" header is Icecast-kh.

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

Switch to Icecast-kh, leave your Nginx config as is and don't forget to add

到您的 Icecast-kh 配置.

to your Icecast-kh config.

这篇关于使用 nginx 代理从监听器获取真实 ip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 00:49