Redirecting all urls from HTTP to HTTPS.

Topics: User Forum
Dec 22, 2010 at 11:15 AM

I've got quite a simply IIRF configuration;

 

RewriteLogLevel 5
RewriteLog D:\Websites\Apptemetry\IirfLogs
RewriteEngine ON
StatusInquiry ON
IterationLimit 5

RewriteCond %{HTTPS} off
RewriteCond %{SERVER_PORT} ^80$
RedirectRule ^(.*)$ https://myServer/$1

 

And the redirection from http://myServer to https://myServer works fine.

However, trying to do it for any other subdirectory inside mysever doesn't work.....

EG  http://myServer/cmdb  doesn't redirect.

Can anyone offer any suggestions?

Wed Dec 22 10:45:11 - 70920 - DoRewrites: Url: 'http://myServer/cmdb/'
Wed Dec 22 10:45:11 - 70920 - EvaluateRules: depth=0
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: getting 'SCRIPT_NAME'
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: 128 bytes
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: result ''
Wed Dec 22 10:45:11 - 70920 - EvaluateRules: no RewriteBase
Wed Dec 22 10:45:11 - 70920 - EvaluateRules: Rule 1: pattern: ^(.*)$  subject: http://myServer/cmdb/
Wed Dec 22 10:45:11 - 70920 - EvaluateRules: Rule 1: 2 match
Wed Dec 22 10:45:11 - 70920 - EvaluateRules: Rule 1: evaluating condition
Wed Dec 22 10:45:11 - 70920 - EvalCondition: cond 0x009D7090
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: getting 'HTTPS'
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: 128 bytes
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: result ''
Wed Dec 22 10:45:11 - 70920 - ReplaceServerVariables: alloc 7 bytes
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: getting 'HTTPS'
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: 128 bytes
Wed Dec 22 10:45:11 - 70920 - GetServerVariable: result ''
Wed Dec 22 10:45:11 - 70920 - ReplaceServerVariables: vName(HTTPS) value()
Wed Dec 22 10:45:11 - 70920 - ReplaceServerVariables: in='%{HTTPS}' out=''
Wed Dec 22 10:45:11 - 70920 - EvalCondition: ts1 ''
Wed Dec 22 10:45:11 - 70920 - GenerateReplacementString: alloc 8 bytes
Wed Dec 22 10:45:11 - 70920 - GenerateReplacementString: result ''
Wed Dec 22 10:45:11 - 70920 - EvalCondition: t() op(|) p(off)
Wed Dec 22 10:45:11 - 70920 - EvalCondition: match result: -1 (No match)
Wed Dec 22 10:45:11 - 70920 - EvalCondition: Cond t(%{HTTPS}) op(|) p(off) => FALSE
Wed Dec 22 10:45:11 - 70920 - EvalCondition: Child is non NULL (parent= 0x009D7090) (child= 0x009D72F0)
Wed Dec 22 10:45:11 - 70920 - EvalCondition: Current condition evaluates to FALSE
Wed Dec 22 10:45:11 - 70920 - EvalCondition: Logical AND, ergo no need to evaluate Child condition
Wed Dec 22 10:45:11 - 70920 - EvalConditionList: rule 1, FALSE, Rule does not apply
Wed Dec 22 10:45:11 - 70920 - EvaluateRules: returning 0

NO REWRITE 'http://myServer/cmdb/' ==> --
ERROR expected(��|@��|♫��|@��|╝�↕)
        actual(NO REWRITE)

Coordinator
Dec 22, 2010 at 3:15 PM

I think what I am looking at there is output from the testdriver.exe program, is that right?

Running your rules through the testdriver won't deliver accurate results.

Your rules depend on server variables which are present only on the server.  They cannot be simulated in a client-side-only testdriver.  This is a documented issue with the testdriver.   (It seems to me though, that you also may have demonstrated a bug in the testdriver - that strangely formatted text output for the expected value doesn't seem right.  I'll have to look at that separately.  But that issue is irrelevant to your question. )

In order to determine if your rules are working, you'll need to run them through a full server environment.  If you do that, and still see a problem, post the IIRF server log file from that transaction, and we'll see if we can diagnose it.  

Dec 22, 2010 at 3:35 PM

I'm unable to get anything in the server log.

If i hit http://myServer then i get lots of log entries (loglevel 5)

But hitting http://myServer/cmdb i don't get a single log entry created.  /cmdb is a virtual directory set as an application, using it's own app pool. I assume this shouldn't be a problem??

Coordinator
Dec 22, 2010 at 5:11 PM

Not a problem using IIRF in virtual directories, but IIRF configuration is done on a per-virtual-directory basis.
http://cheeso.members.winisp.net/Iirf21Help/html/01dedcdc-e657-4519-8bdb-848a1eef1e0e.htm

That means you need an iirf.ini file in the physical dir corresponding to that vdir, with the appropriate rules in the file.