Isapi Rewrite

编程入门 行业动态 更新时间:2024-10-28 08:20:19
本文介绍了Isapi Rewrite - 在负载均衡器后面的重定向中保留HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在运行一个有2个独立子域的站点 - 一个用于HTTP,另一个用于HTTPS。

I'm running a site which has 2 separate sub-domains - one for HTTP and another for HTTPS.

  • www.example
  • secure.example
  • www.example
  • secure.example

secure.example 不存在并且无法解决。

secure.example does not exist and will not resolve.

问题是该网站正在负责处理所有SSL的负载均衡器后面运行。始终在HTTP中负载均衡器和Web服务器之间的通信。

The problem is that the site is running behind a load balancer which handles all SSL. Communication between the load balancer and the web servers in always HTTP.

因此,当使用Isapi Rewrite 3(IIS的mod_rewrite克隆)实现某些重定向时,我正在运行问题。

So, when using Isapi Rewrite 3 (a mod_rewrite clone for IIS) to implement some redirects I'm running into a problem.

就Isapi Rewrite而言,HTTPS已关闭 - 因此重定向 secure.example 失败。

As far as Isapi Rewrite is concerned HTTPS is turned off - so redirects on secure.example are failing.

说我有一条规则说:

RewriteRule ^/example/$ /test/ [R=301,L]

如果我制作请求 secure.example/example/ 我想结束 secure.example/test/ 但是,因为Isapi Rewrite认为HTTPS为OFF,我最终选择 http:/ /secure.example/test/ 。

If I make a request for secure.example/example/ I would like to end up on secure.example/test/ but, because Isapi Rewrite sees HTTPS as OFF, I end up on secure.example/test/.

有什么办法可以强制重定向到HTTPS,如果域名是 secure.example ?

Is there any way I can force redirects to be to HTTPS if the domain is secure.example?

有些内容如下:

RewriteCond %{SERVER_NAME} secure.example RewriteRule ^/(.*)$ secure.example/$1

除非不起作用 - 它会立即强制显式重定向,而我想继续处理其他 RewriteRules 。

Except that doesn't work - it immediately forces an explicit redirect, whereas I want to continue processing other RewriteRules.

谢谢,

Stu

推荐答案

这样的smth怎么样:

How about smth like this:

RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^secure\.mydomain\$ [NC] RewriteRule ^/example/$ secure.mydomain/test/ [R=301,L]

更多推荐

Isapi Rewrite

本文发布于:2023-11-23 23:44:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623210.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Isapi   Rewrite

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!