Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 433
  • Last Modified:

problem with https redirect - IIS7

I am currently doing a https redirect using the following rule:

I have other sites (that I don't have control over) that link to this site using the http protocol.

However, I am having issues with the query string in the URL.

If the URL is http://myurl.com/?afis=12345, it gets redirected to https://myurl.com/?afis=12345&afis=12345

I can't figure out how the extra "afis" is getting added?

any ideas?
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
					<match url="(.*)" />
					<!-- Require SSL must be OFF in the site settings -->
					<conditions>
						<add input="{HTTPS}" pattern="off" ignoreCase="true" />
					</conditions>
					<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" />
				</rule>

Open in new window

0
IUAATech
Asked:
IUAATech
1 Solution
 
Steve BinkCommented:
It is because {REQUEST_URI} includes the query string.  If you have not defined appendQueryString in your action, it is assumed to be true, so it is added again to the end of the rewritten URL.

http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/#Accessing_URL_Parts_from_a_Rewrite_Rule
http://learn.iis.net/page.aspx/465/url-rewrite-module-configuration-reference/#Redirect_action

<action type="Redirect" appendQueryString="False" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" />

Open in new window

0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now