Geo*_*ath 9 iis-7 url-rewriting
我需要为我的IIS 7.5网站编写URL重写规则,该规则捕获特定cookie中的值,然后使用该值构建URL.例如,传入的请求如下所示:
GET http://myserver.com/test.aspx HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: en-US
User-Agent: Mozilla/5.0
Host: myserver.com
Cookie: foo=bar; bat=bar
Run Code Online (Sandbox Code Playgroud)
我想将它们路由到此(基于"foo"cookie值):
http://myserver.com/bar/test.aspx
Run Code Online (Sandbox Code Playgroud)
回顾文档并搜索示例,我很难过!谢谢你的帮助.
Geo*_*ath 11
回答我自己的问题,这是一个有效的例子.该模式可能需要额外的工作,具体取决于需要支持的字符,但以下规则将使用发现的cookie值并路由到发现的服务器 - 并且服务器可以通过IPv4地址或名称(字母数字和周期)指定).
<rule name="Route Base On Cookie" stopProcessing="true">
<match url="^(.*)" />
<conditions>
<add input="{HTTP_COOKIE}" pattern="foo=(.*?);" />
</conditions>
<action type="Rewrite" url="http://{C:1}/{R:0}" />
</rule>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9383 次 |
| 最近记录: |