Rob Rudloff
asked on
https redirect in web.config gives "500" error
Hi.
Without a web.config file in the folder, when I browse to a file in that folder "http://mywebsite.net/gatewaytest.asmx", everything works. Of course it is not secure (http). I can also go to "https://mywebsite.net/gatewayte st.asmx" and I am successful (I get a little lock on the browser bar and the SSL cert properties can be displayed)
I want to create a standard-issue "https redirect" in a web.config file, which appears below.
I copy the web.config file to that folder. Then, when I browse to "http://mywebsite.net/gatewaytest.asmx", I believe it should re-write the address as "https" and bounce me to "https://mywebsite.net/gatewayte st.asmx", but I get an error:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed
So, is there a problem in my web.config file, or do you think there is a problem elsewhere?
Thanks
Without a web.config file in the folder, when I browse to a file in that folder "http://mywebsite.net/gatewaytest.asmx", everything works. Of course it is not secure (http). I can also go to "https://mywebsite.net/gatewayte
I want to create a standard-issue "https redirect" in a web.config file, which appears below.
I copy the web.config file to that folder. Then, when I browse to "http://mywebsite.net/gatewaytest.asmx", I believe it should re-write the address as "https" and bounce me to "https://mywebsite.net/gatewayte
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed
So, is there a problem in my web.config file, or do you think there is a problem elsewhere?
Thanks
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<remove name="Redirect to HTTP" />
<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{ToLower:{HTTP_HOST}{REQUEST_URI}}" appendQueryString="false" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Rainer -- you are awesome!
The URL rewrite module was missing on this server. (I never even thought to look, I'm so used to it already being there.)
I installed the module and everything works great now.
Thanks
The URL rewrite module was missing on this server. (I never even thought to look, I'm so used to it already being there.)
I installed the module and everything works great now.
Thanks
Just to know it is conflicting with any other rules