运行 Apache 2.4.6 的 CentOS 7 充当 Internet 的中央前端 Web 服务器。因此它有一些反向代理连接设置。它们都指向其他 LAMP,并且工作得很好。但是我有一个 IIS 服务器运行其中一个 .Net/ASP 网站,只是不想正确加载。在 Apache 上使用下面的配置,IIS 网站加载所有 html 和 css 的东西。
<VirtualHost *:80>
SeverName example.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /extDirectory/ http://internalserver/internalDirectory/
<Location /extDirectory/ >
ProxyPassReverse http://internalserver/internalDirectory/
Order allow,deny
Allow from all
</Location>
</VirtualHost>
然而,从外部访问站点时,根据此屏幕截图,似乎存在 sessionID 错误:
Apache 日志和我从 IIS 日志中收集到的内容没有显示任何错误。我遇到的唯一错误是在开发人员工具中使用 IE 内置时看到“200 Authorization not found”,即使我已成功登录。
最佳答案
我无法使用 Apache 解决这个问题,因为 ASP.Net 开发人员已经修复了他们的软件。这是他们的回复和解决方案:
Enterprise creates authorization tokens that are used to authenticate each request coming to the server. Every AJAX request must have a valid authentication token, or it will be rejected. Part of the token is the end user's IP address. If the IP address in the AJAX request is different than the original login request, then the token validation will fail and the AJAX request will be rejected. Enterprise v6.5.2 determines the end user's IP address by looking for three specific HTTP headers in this order: HTTP_X_CLUSTER_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR. We think that the proxy server may be sending a different IP address for the AJAX request, which would then cause the token validation to fail and the AJAX request to be rejected.
打开 Enterprise 的 web.config 并在靠近顶部的元素下方添加此行:
<add key="USER_HOST_ADDRESS" value="127.0.0.1" />
保存并关闭 web.config,然后重新启动 IIS。
就是这样。结果证明是 ASP.NET 问题而不是 Apache。
关于asp.net - Apache 反向代理到 IIS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41251218/