【问题标题】:IIS Rewrite Module: Change set-cookie path ruleIIS 重写模块:更改 set-cookie 路径规则
【发布时间】:2020-07-31 02:12:01
【问题描述】:

我正在修改 IIS 中的 tor 反向代理,以便必须通过我的 cgi-bin 中的 php 页面访问它。

这就是我卡住的地方:我需要更改反向代理设置的所有 cookie 的路径值。

例子:

我在浏览器中请求 /cgi-bin/tor.php?url=easycoinsayj7p5l.onion/register.php。向 /tor/easycoinsayj7p5l.onion/register.php 发出后端本地请求。使用 path=/tor/easycoinsayj7p5l.onion/ 设置 php 会话 cookie。此 cookie 设置不正确,因为请求是由 /cgi-bin/tor.php 发出的。需要把路径改成/cgi-bin/,这样cookie才能设置和访问。

以下是我想出的在出站请求部分更改此规则的规则,但是,它似乎没有任何作用。

                <rule name="rewritecookiepath" preCondition="" enabled="true">
                    <match serverVariable="RESPONSE_Set_Cookie" pattern="(.*)(Path=(.*); )(.*)" />
                    <conditions logicalGrouping="MatchAny" trackAllCaptures="true">
                        <add input="{URL}" pattern="(.*)" />
                    </conditions>
                    <action type="Rewrite" value="{R:1} Path=/cgi-bin/; {R:4}" />
                </rule>

请告诉我我缺少什么! -谢谢

【问题讨论】:

    标签: iis cookies url-rewriting arr


    【解决方案1】:

    这条规则对我来说很好。

    所以请启用失败的请求跟踪,它会显示根本原因。我认为 Set-Cookie 标头的值有问题。

    https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-failed-request-tracing-to-trace-rewrite-rules#:~:text=If%20the%20Failed%20Request%20Tracing,module%20installer%20in%20repair%20mode.

    【讨论】:

      猜你喜欢
      • 2015-08-26
      • 2020-09-30
      • 2016-04-26
      • 2014-06-27
      • 2011-07-18
      • 2014-02-02
      • 2020-02-17
      • 1970-01-01
      • 2018-02-01
      相关资源
      最近更新 更多