【问题标题】:How to allow utm_source & utm_medium in IIS Rewrite / Reverse Proxy如何在 IIS 重写/反向代理中允许 utm_source 和 utm_medium
【发布时间】:2021-11-14 18:28:00
【问题描述】:

我已经创建了反向代理 Windows server 2016 和 IIS。

一切正常,但问题在于它不允许这样的 url,

https://mywebsite/shop/product/3231?utm_source=IGShopping&utm_medium=Social

但是当我将utm_source 替换为utm_sour 或其他东西时,它可以正常工作。

简单来说,使用utm_sourceutm_medium 变量会出现此错误。 Screenshot of the error

直接使用本地主机它工作正常。 https://mywebsite/shop/product/3231?utm_source=IGShopping&utm_medium=Social

供参考,我的web.config文件如下

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>

            <outboundRules>
            
            
                <clear />

      <rule name="Add SameSite" preCondition="No SameSite">

        <match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" />

        <action type="Rewrite" value="{R:0}; SameSite=None; Secure" />

      </rule>
                <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" enabled="true">
                    <match filterByTags="A, Form, Img" pattern="^http(s)?://localhost:8068/(.*)" />
                    <action type="Rewrite" value="http{R:1}://mocauae.ae/{R:2}" />
                </rule>
                <preConditions>
                    <preCondition name="ResponseIsHtml1">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                    </preCondition>
                    
                    <preCondition name="No SameSite">

          <add input="{RESPONSE_Set_Cookie}" pattern="." />

          <add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=None; Secure" negate="true" />

        </preCondition>
                    
                    
                </preConditions>
                
            </outboundRules>
            <rules>
                <rule name="ReverseProxyInboundRule1" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://localhost:8068/{R:1}" />
                </rule>
                <rule name="HTTPS" enabled="false" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="http://localhost:8068" redirectType="Found" />
                </rule>
                <rule name="HTTPS force" enabled="false" stopProcessing="true">
 <match url="(.*)" />
 <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
 </conditions>
 <action type="Redirect" url="https://localhost:8068" appendQueryString="false" redirectType="Permanent" />
 </rule>
                <rule name="https pure" enabled="false" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <action type="Redirect" url="https://localhost:8068" redirectType="Found" />
                    <conditions>
                        <add input="{HTTP}" pattern="off" />
                    </conditions>
                </rule>
            </rules>
        </rewrite>
        <httpRedirect enabled="false" destination="http://localhost:8068" exactDestination="true" />
    </system.webServer>
</configuration>

【问题讨论】:

    标签: iis server url-rewriting web-config odoo


    【解决方案1】:

    我只是简单地忽略 url 参数的解决方案,它对我有用

    <rule name="IngnoreUTMSource" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{QUERY_STRING}" pattern="utm_source=.*" />
      </conditions>
      <action type="Redirect" url="http://{HTTP_HOST}/{R:0}" appendQueryString="false" redirectType="Permanent" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-21
      • 2013-01-28
      • 1970-01-01
      • 2020-01-25
      • 1970-01-01
      • 2020-09-05
      相关资源
      最近更新 更多