特定域的URL重写规则

时间:2020-07-02 20:06:32

标签: iis url-rewriting web-config iis-10

特定域的URL重写规则

如果url为https且仅具有此域

let results =
  instruments
  |> List.map (fun i -> getBinanceSymbolFromInstrument i)
  |> List.map (fun i -> 
       restClient.CancelAllOrdersAsync (i)
       |> Async.AwaitTask)
  |> Async.Parallel
  |> Async.RunSynchronously
  |> List.ofArray
  |> List.filter (fun r -> not r.Success)
  |> List.fold (fun acc m -> 
       m.Error.Code, 
       sprintf "%s\n%i - %s" (snd acc) m.Error.Code m.Error.Message)) (0, String.Empty)

将其重定向到

https://myServer/SomeApplication/

以下添加的内容在Windows Server 2019的iis 10中不起作用

https://myServer.mycompany.com/SomeApplication/

有人可以解释我做错了什么吗?

1 个答案:

答案 0 :(得分:0)

Rule模式只能获取URL字符串作为输入,不包含查询字符串,因此无法正常工作。
这是有关如何从重写规则访问URL字符串某些部分的正式说明。
https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference#accessing-url-parts-from-a-rewrite-rule
我们可以在Rule Condition部分中匹配主机名,然后应用Rule Action

        <rule name="Myrule2" enabled="true" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTP_HOST}" pattern="localhost" />
            </conditions>
            <action type="Redirect" url="https://vabqia969vm/" />
        </rule>
    </rules>
</rewrite>

请随时让我知道问题是否仍然存在。