Mono Support SSL Enforce (Closed)

Viewed 16836 time(s), 3 post(s), 7/17/2012 11:33:15 AM - by developer
7/17/2012 11:33:15 AM
165 Reputation 19 Total posts

Hello boys,

I need to enforce HTTPS when user write only HTTP in browser. How can i make this? I tried to add <if> into <UrlRewriter>, but don't work.

And when I add this code into <system.webserver> section, I got "Internal server Error":

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

Thanks.

1
7/17/2012 1:51:56 PM
15993 Reputation 2214 Total posts

Hi,

if you are using IIS then you can use the following routine to manage this.

Let me know if this suites your needs.

Regards

2
7/18/2012 11:08:02 AM
165 Reputation 19 Total posts

Yes, it works.

Before I tried to use this,

<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>

but it doesn't work, because the Microsoft URL Rewrite module was not installed on my server. Now it's OK.

3
This is a demo site for MonoX. Please visit Mono Software for more info.