Solved

How to send any request to https

Posted on 2014-12-04
5
91 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 14

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 14

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

863 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

25 Experts available now in Live!

Get 1:1 Help Now