-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package require -exact testcl 1.0.7 | ||
namespace import ::testcl::* | ||
|
||
# Comment in to enable logging | ||
#log::lvSuppressLE info 0 | ||
|
||
it "should redirect to the same url but using https" { | ||
event HTTP_REQUEST | ||
on HTTP::uri return "/bar" | ||
on HTTP::host return "www.foo.com" | ||
endstate HTTP::redirect https://www.foo.com/bar | ||
run irules/call_irule.tcl call | ||
} | ||
|
||
stats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
rule call { | ||
|
||
proc Redirect {url} { | ||
|
||
HTTP::redirect $url | ||
|
||
} | ||
|
||
when HTTP_REQUEST { | ||
|
||
set lowerUri [string tolower [HTTP::uri]] | ||
set lowerHost [string tolower [HTTP::host]] | ||
|
||
call Redirect https://$lowerHost$lowerUri | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters