Problems redirecting to a secure URL with IIS 6.0

Topics: User Forum
Apr 26, 2010 at 8:26 PM
Hi, I am running IIS 6.0 in Windows Server 2003 SP2. I have installed IIRF 2.0 successfully. It shows as loaded in the ISAPI filter list and I am getting a log file generated. Hoever, what I thought should be something very simple is not working at alll. My site is http://www.mypersonaldomain.org.uk. Under this I have various directories and pages etc. including www.mypersonaldomain.org.uk/secure - this directory is set in IIS as 'needs a secure connection' so must be accesses as https:////www.mypersonaldomain.org.uk/secure. All directories below this also are set to 'need a secure connection'. www.mypersonaldomain.org.uk/secure/pwd - this directory is additionally set to require user authentication with anonymous access disabled. What I'd like to do is to force any attempt to access http://www.mypersonaldomain.org.uk/secure/... to be redirected to https://www.mypersonaldomain.org.uk/secure/... So, I set up the following IIRF.ini file: RewriteEngine ON StatusUrl /iirfStatus RewriteLogLevel 4 RewriteLogFile c:\inetpub\IIRF\logs\live IterationLimit 5 RedirectRule ^http://www.thejenkinsfamily.org.uk/secure/(.*)$ https://www.thejenkinsfamily.org.uk/secure/$1 [R=301] When I modify this file and save it then the next time I access a URL on this site I see the IIRF log entries saying that the INI file has been modified. However, when I attempt to access a URL involving 'secure' such as http://www.mypersonaldomain.org.uk/secure/pwd/index.html than all I get back is the IIS error saying that 'this site must be accessed over a secure channel, try typing https: at the start of the request'. Also, there are no records of the request in the IIRF log! it's almost like IIS is throwing the error about needing https *before* IIRF has had a chance to intercept and re-direct the URL. SI this possible? Or am I mis-configured somehow? Any advice or suggestions would be gratefully received as I am really stuck at this point. Thanks.
Coordinator
Apr 26, 2010 at 10:41 PM
Edited Apr 26, 2010 at 10:42 PM

yes, it' not configured properly.

You shouldn't put the scheme in the URL pattern.  RedirectRule (and RewriteRule) examines the URL Path, not the full URL.  This may be confusing, but this is how it works in Apache, and in pretty much every rewriter I know of.

You can test for the use of SSL in a RewriteCond.  Here's an example:

http://cheeso.members.winisp.net/Iirf20Help/html/5a3d3e7f-5f40-484d-a4af-2f395f94b6f2.htm

You'll want to use ^/secure  as the pattern on the RedirectRule.