为 IIS 创建一个 HTTP 处理程序,将请求透明地转发到不同的端口?
我有一个公共 Web 服务器,安装了以下软件:
- 端口80 上的 IIS7
- 端口 81 上基于 apache 的 Subversion
- 端口 82 上基于 apache 的 TeamCity
不幸的是,Subversion 和 TeamCity 都附带了自己的 Web 服务器安装,并且它们工作完美,所以我不这样做如果可能的话,我真的不想尝试将它们全部移至 IIS 下运行。
但是,我在查看 IIS 时注意到 HTTP 重定向部分,我想知道...
我是否可以创建一个 HTTP 处理程序,并将其安装在 IIS7 下的子域上,以便所有请求,比如说, http://svn.vkarlsen.no/anything/here 传递给我的HTTP 处理程序,然后创建一个到 http://localhost:81/anything/here 的请求,检索数据并将其传递给原始请求者?
换句话说,我希望 IIS 能够处理到端口 81 和 82 的透明转发,而不使用重定向功能。例如,Subversion 不喜欢 HTTP 重定向,只是说存储库已移动,我需要重新定位我的工作副本。那不是我想要的。
如果有人认为可以做到这一点,是否有人有我需要阅读的主题的链接?我认为我可以管理实际的请求部分,即使有身份验证,但我不知道如何创建 HTTP 处理程序。
另请记住,我需要处理顶级域下的子路径和文档,因此 http: //svn.vkarlsen.no/whatever/here 需要由单个处理程序处理,我无法为所有子目录创建处理程序的副本,因为路径会不时创建。
I have a public web server with the following software installed:
- IIS7 on port 80
- Subversion over apache on port 81
- TeamCity over apache on port 82
Unfortunately, both Subversion and TeamCity comes with their own web server installations, and they work flawlessly, so I don't really want to try to move them all to run under IIS, if that is even possible.
However, I was looking at IIS and I noticed the HTTP redirect part, and I was wondering...
Would it be possible for me to create a HTTP handler, and install it on a sub-domain under IIS7, so that all requests to, say, http://svn.vkarlsen.no/anything/here is passed to my HTTP handler, which then subsequently creates a request to http://localhost:81/anything/here, retrieves the data, and passes it on to the original requestee?
In other words, I would like IIS to handle transparent forwards to port 81 and 82, without using the redirection features. For instance, Subversion doesn't like HTTP redirect and just says that the repository has been moved, and I need to relocate my working copy. That's not what I want.
If anyone thinks this can be done, does anyone have any links to topics I need to read up on? I think I can manage the actual request parts, even with authentication, but I have no idea how to create a HTTP handler.
Also bear in mind that I need to handle sub-paths and documents beneath the top-level domain, so http://svn.vkarlsen.no/whatever/here needs to be handled by a single handler, I cannot create copies of the handler for all sub-directories since paths are created from time to time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 IIS 的应用程序请求路由插件将 IIS 配置为 反向代理。
Try the Application Request Routing addon for IIS to configure IIS as a reverse proxy.