0

I have IIS 10 running locally in my development environment. I am trying to test an SSO solution with a test ADFS instance. However, ADFS only allows for a secured endpoint to redirect to. I need to setup my local environment to change any requests that come in as https to http. Here is the configuration I have tried:

            <rule name="Force Http" enabled="true" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="on" />
                </conditions>
                <action type="Rewrite" url="http://{HTTP_HOST}/{REQUEST_URI}" />
            </rule>

The user is not being redirected and I am just getting a 404. I have tried with and without an https binding on the default website that I have the site sitting under.

Tony
  • 1,366
  • 1
  • 10
  • 9
  • HTTPS and HTTP are different connections, so you cannot rewrite but redirect. – Lex Li May 16 '18 at 01:52
  • Yes, sorry that was one iteration of me trying different things. I originally had it as a redirect. – Tony May 16 '18 at 02:10
  • The second mistake is that nobody would decode "{HTTP_HOST}" nor "{REQUEST_URI}" for you. Use Google to carefully learn the examples of URL rewriting rules, and see how to do that correctly. – Lex Li May 16 '18 at 02:15
  • https://stackoverflow.com/questions/1536120/rewriting-urls-from-https-to-http-in-iis7 and https://forums.iis.net/t/1235598.aspx?URL+Rewrite+HTTPS+to+HTTP are some of the examples I was using – Tony May 16 '18 at 03:17

1 Answers1

0

Here is the solution that finally worked for me:

<rule name="No-https" enabled="true" stopProcessing="true">
 <match url=".*" negate="false" />
 <action type="Redirect" url="http://{HTTP_HOST}{REQUEST_URI}" />
 <conditions trackAllCaptures="false">
  <add input="{SERVER_PORT_SECURE}" pattern="^1$" />
 </conditions>
</rule>
Tony
  • 1,366
  • 1
  • 10
  • 9