如何判断请求的 URL 是否是在 http 上调用服务器的内容交换机后面的 HTTPS?

发布于 2024-08-22 03:38:04 字数 563 浏览 5 评论 0原文

我有经典的 asp 网页,在其中我在 IIS 盒子上使用 MSXML2 调用 XML 源。 MSXML2 需要完整的 URL http://www.dom.com/path 等,这一切都有效非常好,直到我尝试在 https url 上的内容开关后面的服务器上安装。

经过一些调试后,我发现内容交换机没有 http 流量的路径,因此对 http url 的调用失败,我可以通过将目标 url 更改为 https 来解决此问题。

由于此代码同时用于 http 和现在的 https,我想切换代码中的 URL 类型,因此我确实有代码分支。

我认为这很容易,这会成功

if Request.ServerVariables("HTTPS") = "off" then 

但是没有内容交换机持有证书而不是计划http流量的Web服务器

任何人都可以想办法让我可以告诉我使用https/http或任何其他的完整URL是什么我可以修复它。

非常感谢保罗

I have classic asp web page in which I am calling an XML source using MSXML2 on an IIS box. MSXML2 requires a full URL http://www.dom.com/path etc. and this all work very well until I tried to install on a server behind a content switch on https url.

After some debuging I worked out the that the content switch didn't have path for http traffic so the the call to the http url failed I was able to fix this my change the target url to https.

As this code is used on both http and now https I wanted to switch the the URL type in code so I did have code fork.

I throught this would be easy and that this would do the trick

if Request.ServerVariables("HTTPS") = "off" then 

But no the content switch hold the cert not the web server which is plan http traffic

Can anybody think of way that I can tell what the FULL URL with https/http or any other way I can fix it.

Many thanks Paul

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

慕巷 2024-08-29 03:38:04

如果不详细了解您所说的“内容交换机”(无论是什么)设备,就很难回答这个问题。

也许最好的起点是这个简单的 ASP 页面:-

<%

Dim vntKey

For Each vntKey In Request.ServerVariables
    Response.Write vntKey & " = " & Server.HTMLEncode(Request.ServerVariables(vntKey)) & "<br />"
Next

%>

在客户端上通过 HTTPS 点击此页面,出现的 HTTP 标头列表可能会显示设备添加的一些其他自定义标头,这可能允许您做出所需的决定。

编辑

另一种方法可能是将内部服务器配置为侦听端口 80 和 8080。配置反向代理以将到达 443 的请求转发到服务器的端口 8080。现在您可以检测到 HTTPS,因为请求到达您的内部服务器上的 8080。

Its difficult to answer this without detailed knowledge of the appliance which your refer to as a "Content switch", whatever that may be.

Perhaps the best place to start would be with this simple ASP page:-

<%

Dim vntKey

For Each vntKey In Request.ServerVariables
    Response.Write vntKey & " = " & Server.HTMLEncode(Request.ServerVariables(vntKey)) & "<br />"
Next

%>

Hit this via HTTPS on the client, the list of HTTP headers that appears may reveal some additional custom headers added by the appliance which may allow you to make the determination you need.

Edit

An alternative might be to configure your internal server to listen on both port 80 and say 8080. Configure the reverse proxy to forward requests arriving on 443 to port 8080 of your server. Now you can detect HTTPS because the request arrived at 8080 on your internal server.

相思故 2024-08-29 03:38:04

如果原始请求通过 https 传入,您需要修改内容开关以发送特殊标头。我们在工作中使用 Zeus ZXTM,我可以添加一条流量规则,规定如果请求以 https 开头,则添加一个名为“FROM_SSL”且值为 true 的标头。然后我检查后端的标头,而不是使用内置的东西。

You need to modify the content switch to send a special header if the original request came in through https. We use Zeus ZXTM where I work and I can add a traffic rule that says if request begins with https, to add a header called "FROM_SSL" with a value of true. I then check that header on the back end, rather than using the built in stuff.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文