Forum Discussion
steve_cross_650
Nimbostratus
Dec 27, 2006redirect http to https and vise versa
I had asked this question in another thread (http://devcentral.f5.com/default.aspx?tabid=28&view=topic&forumid=5&postid=11139) but never got an answer so I thought I would createmy own ticket in hopes of getting a response .....
I have a String Data Group called "secure_pages" that contains a list of pages that I want to be secure on our website:
/login.aspx
/enterCreditCard.aspx
/changePassword.aspx
Now in my iRule, I want to make sure that if the host is a certain domain (we have more than one) and the page is listed in my "secure_pages", change the URL to https. This all works fine with the following code:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "test.mywebsite.com"}
{
if { [matchclass [string tolower [HTTP::uri]] starts_with $::secure_pages]}
{
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
else
{
pool pool_A
}
}
else
{
pool pool_B
}
}
The problem is that once the URL has been changed to https, ALL of the subsequent pages that the user goes to are https b/c our links in the application are all relative paths. So I need a way to make sure that any pages that are NOT listed in "secure_pages" are always treated as http (and not https). Here is our business senario:
1) User comes to our home page (http)
2) Clicks on a link to "login.aspx". Login is in "secure_pages" string data group so they are redirected to an https page
3) Upon successful login we automatically redirect user to page2 (http)
Unfortunately no matter what I try the step 3 always remains https OR it doesn't do the redirect at all. Any thoughts?
2 Replies
- Kenny_Van_73892
Nimbostratus
I'm not familiar with irules in version 9 but try this and correct syntax - steve_cross_650
Nimbostratus
I already had that code in place. Basically, what I am looking for is a way to make sure that every time something is going to pool_A that it is going there as a HTTP and not HTTPS.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects