{"id":1340,"date":"2015-10-01T18:39:11","date_gmt":"2015-10-02T01:39:11","guid":{"rendered":"http:\/\/jim-zimmerman.com\/?p=1340"},"modified":"2015-10-01T18:39:11","modified_gmt":"2015-10-02T01:39:11","slug":"iis-redirect-from-http-to-https","status":"publish","type":"post","link":"https:\/\/jim-zimmerman.com\/?p=1340","title":{"rendered":"IIS Redirect from http to https"},"content":{"rendered":"<p>Windows Server 2012 fully updated.<br \/>\nIIS version 8.<br \/>\nExchange 2010 fully updated.<\/p>\n<p>Initially, I tried doing this with the default &#8220;HTTP Redirect.&#8221;  I simply wanted to have a more generic DNS name using HTTP to redirect to the Outlook Web Access URL using HTTPS.  This introduced to a couple issues.  One, I needed to have SSL not be required for the &#8220;Default Web Site&#8221;, and two, I created a loop since the redirect will apply to all virtual directories below the &#8220;Default Web Site.&#8221;<\/p>\n<p>I discovered the &#8220;URL Rewrite&#8221; module below:<br \/>\n<a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=7435\">http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=7435<\/a><\/p>\n<p>Previously, I had used rewrite rules in Apache to accomplish a similar task, so I knew I was on the right track.<\/p>\n<p>First thing you have to do is get the SSL settings right.  For this I used the IIS Manager UI.  I wish I had taken the time to find out how to do this with PowerShell, and here is why.  For the &#8220;Default Web Site&#8221;, you open &#8220;SSL Settings&#8221; and uncheck &#8220;Require SSL.&#8221;.  Now, when you do this, it will change it for all your virtual directories.  So, you have select each virtual directory, open &#8220;SSL Settings&#8221;, and check &#8220;Require SSL.&#8221;  Ugh.<\/p>\n<p>Once that is done, install the &#8220;URL Rewrite&#8221; module.  It is pretty straight forward.  Once it is installed, you need to restart IIS using &#8220;iisreset&#8221;.  Back in IIS Manager, select &#8220;Default Web Site&#8221; and you will notice a &#8220;URL Rewrite&#8221; icon as been added.  Open it up and click &#8220;Add Rule..&#8221; under the Action menu.  You give it a name, and the pattern to match.  The &#8220;Action type&#8221; is &#8220;Rewrite&#8221;, and the &#8220;Rewrite URL&#8221; is where you put the HTTPS url.  <\/p>\n<p>Here is what I used to redirect http:\/\/mail to https:\/\/myexchangeserver.my.domain\/owa:<br \/>\nPattern: Matches the Pattern<br \/>\nUsing: Regular Expressions<br \/>\nPattern: http:\/\/mail<br \/>\nIgnore case: checked<br \/>\nNo Conditions added.<br \/>\nNo Server Variables added.<br \/>\nAction type: Rewrite<br \/>\nRewrite URL: https:\/\/myexchangeserver.my.domain\/owa<br \/>\nAppend query string: checked<br \/>\nLog rewritten URL: unchecked<br \/>\nStop processing of subsequent rules: unchecked<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows Server 2012 fully updated. IIS version 8. Exchange 2010 fully updated. Initially, I tried doing this with the default &#8220;HTTP Redirect.&#8221; I simply wanted to have a more generic DNS name using HTTP to redirect to the Outlook Web Access URL using HTTPS. This introduced to a couple issues. One, I needed to have [&#038;hellip<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[125,411,405,331,412],"class_list":["post-1340","post","type-post","status-publish","format-standard","hentry","category-documentation","tag-exchange","tag-iis","tag-owa","tag-redirect","tag-rewrite"],"share_on_mastodon":{"url":"","error":""},"_links":{"self":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1340"}],"version-history":[{"count":1,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1340\/revisions"}],"predecessor-version":[{"id":1341,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=\/wp\/v2\/posts\/1340\/revisions\/1341"}],"wp:attachment":[{"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jim-zimmerman.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}