我需要将访问者的真实IP转发到Apache Load Balancer。我已经在Nginx上成功完成了它,只需添加以下两行:
avformat_version(): 3756900 Build: 3756900 Ident: Lavf57.83.100
avformat_open_input(): rtsp://admin:public_pwd@192.168.1.237
Probing rtsp score:100 size:0
[tcp @ 0x56263b430a20] No default whitelist set
[rtsp @ 0xaddr1] Sending:
OPTIONS rtsp://192.168.1.237:554 RTSP/1.0
... [snipped]
Initial authentication handshake (OPTIONS, DESCRIBE, SETUP).
All success, server replies: 'RTSP/1.0 200 OK'
....
[rtsp @ 0xaddr1] Sending:
PLAY rtsp://192.168.1.237:554/ RTSP/1.0
Range: npt=0.000-
CSeq: 5
User-Agent: Lavf57.83.100
Session: 420467284
Authorization: Digest username="admin", realm="IP Camera(C1003)", nonce="129b254c8da4e0ffb530f64f79938bcd", uri="rtsp://192.168.1.237:554/", response="82c6c0f1fadea3739846866e8e50e855"
--
[rtsp @ 0xaddr1] line='RTSP/1.0 200 OK'
[rtsp @ 0xaddr1] line='CSeq: 5'
[rtsp @ 0xaddr1] line='Session: 420467284'
[rtsp @ 0xaddr1] line='RTP-Info: url=rtsp://192.168.1.237:554/trackID=1;seq=43938;rtptime=4022155312'
[rtsp @ 0xaddr1] line='Date: Thu, Aug 02 2018 15:53:00 GMT'
[rtsp @ 0xaddr1] line=''
avformat_open_input(): Success erc: 0
avformat_find_stream_info()
[h264 @ 0xaddr2] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0xaddr2] nal_unit_type: 8, nal_ref_idc: 3
[rtsp @ 0xaddr1] UDP timeout, retrying with TCP
[rtsp @ 0xaddr1] ...
... Stalls waiting for additional packets
我还在网站上找到了上述解决方案(针对Nginx),该解决方案说明了适用于Apache和Nginx的解决方案,但不适用于Apache。通常,解决方案是将Apache服务器作为后端服务器共享的。 但是,就我而言,Apache是负载平衡器。我也尝试过使用mod_rpaf,但它要么无法正常工作,要么无法成功应用。
答案 0 :(得分:0)
以反向代理方式运行时(例如,使用ProxyPass指令),mod_proxy_http添加多个请求标头,以便将信息传递到原始服务器。这些标题是:
X-Forwarded-For 客户端的IP地址。 X转发主机 客户端在Host HTTP请求标头中请求的原始主机。 X转发服务器 代理服务器的主机名。
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#x-headers