asp.net - Apache 反向代理到 IIS

标签 asp.net apache iis centos reverse-proxy

运行 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 错误: External-gets-error

与内部访问同一站点相比: internal-is-OK

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/

相关文章:

asp.net - IE 上的网站安全证书信息

.net - 对于 IIS 上的 Web 应用程序,Net 4.5 的正确应用程序池是什么?

c# - POST 和 GET 方法可以进入不同的 View 吗?

python - Apache mod_wsgi Django 设置 - 禁止您无权访问此服务器上的/mysite

mysql - 如何使用新的 VPS 在非 root 帐户下安装 apache

multithreading - 当Apache工作程序启动其自己的工作程序线程或进程时会发生什么?

angular - asp.net 核心 web 应用程序发布命令没有正确部署 Angular 客户端应用程序

c# - 在基本 Controller 上使用 WebApi RoutePrefix 属性

c# - 如何将项目添加到列表

c# - 我应该执行许多 sql 查询还是一个大型查询并在服务器上进行处理?