有没有办法让它看起来像两个程序正在监听80端口
我确实知道我不能让两个程序监听同一个端口,但我想知道是否可以以某种方式伪造它,例如:
我的机器有两个应用程序,一个监听端口 806653。
如果我收到传入连接,假设 mysite.com:80/chat ,那么它将在内部转发到侦听端口 6653 的应用程序,并且从该服务器返回的数据将以某种方式转发回端口 80。
我想实现这一点的原因是因为有许多防火墙似乎阻止与 80 以外的端口的连接。
我有一个聊天服务器,我想在端口 80 上运行,也许我可以为此获得另一个 IP 和机器,但是对于单个聊天服务器来说感觉太麻烦了。
任何有用的反馈将不胜感激。谢谢!
I do know that I can't have two programs listening to the same port, but I am wondering if it is possible to fake it somehow, for an example:
My machine has two applications, one listening to port 80 and the other to port 6653.
If I get an incoming connection, let's say mysite.com:80/chat then it would be forwarded internally to the application listening on port 6653 and the data returned from that server would be forwarded back to port 80 somehow.
The reason I want to accomplish this is because there are many firewalls that seem to block connections to ports other than 80.
I have a chat server that I want to run on port 80, perhaps I could get another IP and machine for that, but it feels like too much trouble for a single chat server.
Any helpful feedback would be appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您运行的是 Apache,您可以使用 mod_rewrite 来完成此操作。该链接有很多示例,包括您想要的(我认为)。
编辑:我看到您已将标签更新为“asp.net”。那么我猜你没有运行 Apache。我确信 IIS 有类似的工具,或者您可以使用代理服务器来完成相同的操作。
You can probably do this with mod_rewrite if you're running Apache. That link has plenty of examples, including what you want (I think).
EDIT: I see you've updated the tags to say "asp.net". I'm guessing that you're not running Apache, then. I'm sure there is a similar tool for IIS, or you can use a proxy server that does the same thing.
您可以在 Windows Server 2008(和 R2)上安装一个名为 URL Rewrite 的模块,其功能与 Mod_Rewrite 相同。在此下载:http://www.iis.net/download/URLRewrite
There is a module called URL Rewrite that you can install on Windows Server 2008 (and R2) that is functionally the same as Mod_Rewrite. Download it here: http://www.iis.net/download/URLRewrite