query string get appened more than once

蹲街弑〆低调 提交于 2019-12-11 09:35:19

问题


I am using url rewrite module (from here). I have following rule defined in my web.config to direct any http traffic to https.

<rewrite>
      <rules>
        <rule name="https redirect" enabled="true" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="SeeOther" />
        </rule>
      </rules>
</rewrite>

I have one question. My url may also contains some encrypted and encoded data in query string. Seem like this rule is changing the parameters by appendding the query parameter more than once as shown below.

Actual url
http://www.MySite.com?Data=nBdHuQ6Jt2nHCnh5FG

After rule applied
https://www.MySite.com?Data=nBdHuQ6Jt2nHCnh5FG?Data=nBdHuQ6Jt2nHCnh5FG

Any ideas what I am doing wrong in this rule?


回答1:


You need to change {HTTP_HOST}{REQUEST_URI} for {HTTP_HOST}{URL}



来源:https://stackoverflow.com/questions/12698625/query-string-get-appened-more-than-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!