IIS Rewrite Rule Redirect HTTP to HTTPS causes multiple RedirectURL querystring
<p>We're using this rule to redirect HTTP to HTTPS:</p>

<pre><code>&lt;rewrite&gt;
    &lt;rules&gt;
        &lt;rule name="Redirect HTTP to HTTPS" enabled="true" stopProcessing="true"&gt;
            &lt;match url="(.*)" /&gt;
            &lt;conditions&gt;
                &lt;add input="{HTTPS}" pattern="^OFF$" /&gt;
            &lt;/conditions&gt;
            &lt;action type="Redirect" url="https://{HTTP_HOST}{HTTP_URL}" redirectType="SeeOther" /&gt;
        &lt;/rule&gt;
    &lt;/rules&gt;
&lt;/rewrite&gt;
</code></pre>

<p>This works fine but when a user has bookmarked a URL like this:</p>

<pre><code>h t t p://www.mysite.com/myapp/login.aspx?ReturlURL=/someurl
</code></pre>

<p>It redirect them to HTTPS as expected but with 2 ReturnURL querystring which causes a 404 error when they login:</p>

<pre><code>h t t p s://www.mysite.com/myapp/login.aspx?ReturnURL=/someurl&amp;ReturnURL=/someurl
</code></pre>

<p>How to handle this case? Thanks in advance!</p>