将流量重定向到其他网络服务器
这是我的设置:我有一个 Python Web 服务器(我自己编写),它侦听端口 80,并且还有一个 Transmission-daemon(bittorrent 客户端),它在端口 9101 上提供 WebUI。(在 Linux 上运行)
我可以在本地访问这两个 Web 服务器,而无需问题,但现在也想从外部访问它们。我的问题是,我不想在防火墙上打开额外的端口来访问 Transmission webUI。是否可以在 python Web 服务器内将某些流量重定向到适当的端口。
例如: http://mywebserver/index.html ->由 Python 网络服务器提供服务
http://mywebserver/transmission.html ->重定向到传输(当前为http://localhost:9101)
谢谢
Here is my setup: I have a Python webserver (written myself) that listens on port 80 and also have the Transmission-daemon (bittorrent client) that provides a webUI on port 9101. (running on Linux)
I can access both webservers locally without problems, but now would like to access them externally also. My issue is that I would prefer not to have to open extra ports on my firewall to access the Transmission webUI. Is it possible to within the python webserver to redirect some traffic to the appropriate port.
So for example:
http: //mywebserver/index.html -> served by the Python webserver
http: //mywebserver/transmission.html -> redirected to transmission (which is currently http: //localhost:9101)
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我找到了答案:反向代理。它将根据 URL 负责路由到正确的端口。我现在只需选择正确的一个,有很多(NginX、pound、lighttd 等...)
无论如何,谢谢。
I found my answer: a reverse proxy. It will take care of the routing to the correct port based on the URL. I now just have to select the right one there are so many (NginX, pound, lighttd etc...)
Thanks anyway.
返回状态码为 300 的 http 响应,请参阅此
Return an http response with status code 300, see this