Solved

How to send any request to https

Posted on 2014-12-04
5
87 Views
Last Modified: 2014-12-27
HI

I have got typical problem in URL rewrite. the scenario is as mentioned below.

I have got domain abc.com and standard certificate procured  is in the name of www.abc.com. I have configured IIS with rules which takes any request (e.g. http://abc.com or http://www.abc.com) to https://www.abc.com and this is working fine.

however, when I tried accessing https://abc.com it gives certificate invalid error. my URL write rules are attached herewith.

The server is hosting  multiple sites and need to bind the SSL for abc.com and expected result is smooth error-free access of https://www.abc.com no matter how it is typed (e.g. http://www.abc.com, http://bac.com, https://abc.com and of course https://www.abc.com)

Pls. suggest the options possible without changing the SSL certificate.

web.config
0
Comment
Question by:Mickail
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Edwin Hoffer
ID: 40480408
Hello Mickail,

Try the below code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://www.abc.com" redirectType="Permanent" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Open in new window


Thanks
Edwin
0
 

Author Comment

by:Mickail
ID: 40481358
Hi Edwin

really appreciate for the response. however, still the problem remains the same.

let me re-iterate it again.

1. the ssl cert is in the name of www.abc.com
2. the website should be accessible without any certificate error  and go to https://www.abc.com thru any of the following URLs.
http://www.abc.com (it works with your rule)
http://abc.com (it works with your rule)
https://www.abc.com (it works with your rule)

Exception
http://abc.com  (its giving certificate error and does not go to https://www.abc.com works with your rule)

hope I am able to explain the situation clearly.

best regards.
0
 
LVL 13

Expert Comment

by:Edwin Hoffer
ID: 40482226
Hello Mickail,

Try the below code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://www.abc.com" redirectType="Permanent" appendQueryString="false" />
                </rule>
				<rule name="Redirect to WWW" stopProcessing="true">
					<match url=".*" />
					<conditions>
						<add input="{HTTP_HOST}" pattern="^abc.com$" />
					</conditions>
					<action type="Redirect" url="http://www.abc.com/{R:0}" redirectType="Permanent" />
				</rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Open in new window


This will redirect non www users to www

Thanks
Edwin
0
 

Accepted Solution

by:
Mickail earned 0 total points
ID: 40512616
This also didn't workout.

Client has now dropped the idea of running the domain without https://.  So this seems now resolved.
0
 

Author Closing Comment

by:Mickail
ID: 40519466
Client has now dropped the idea of running the domain without https://.  So this seems now resolved.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now