In the end I settled on just a host-name redirect.
<system.webServer> <.other.> <rewrite> <rules> <rule name="HostName" enabled="true" stopProcessing="false"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="YOUR\.SERVICENAME\.cloudapp\.net" /> </conditions> <action type="Redirect" url="{MapSSL:{HTTPS}}/YOURHOSTNAME/{R:1}"/> </rule> </rules> <rewriteMaps> <rewriteMap name="MapSSL" defaultValue="OFF"> <add key="ON" value="https://" /> <add key="OFF" value="http://" /> </rewriteMap> </rewriteMaps> </rewrite> </system.webServer>
Many thanks to RuslanY for his tips: http://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/.
This rule was inspired from the stackoverflow: http://stackoverflow.com/questions/2608994/iis7-url-rewriting-how-not-to-drop-https-protocol-from-rewritten-url
Of additional interest: http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
No comments:
Post a Comment