Forum Discussion
Eric_Frankenfie
Nimbostratus
Jun 25, 2010HTTP Redirects
I am new to iRules and going through baptism by fire.
I would like the following URLs: http://www.qa.ipcws.fiserv.com, http://qa.ipcws.fiserv.com, https://www.qa.ipcws.fiserv.com, https://qa.ipcws.fi...
hoolio
Cirrostratus
Jun 26, 2010Hi Eric,
If you want to redirect all of the HTTP requests to HTTPS preserving the URI, you can use the HTTP::redirect rule you posted. You could leave off the check for the port being 80 as all requests to the HTTP VS would be on port 80:
HTTP_REQUEST {
HTTP::redirect "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
}
For the HTTPS VS, you can use an iRule like this to check the Host header value:
when HTTP_REQUEST {
Check the requested host set to lowercase
switch [string tolower [HTTP::host]] {
"www.qa.ipcws.fiserv.com" -
"qa.ipcws.fiserv.com" {
Matched the host check, send a 301 with the new location
HTTP::respond 301 Location "https://qa.ipcws.fiserv.com/cws.web/Login.aspx"
}
default {
Take some default action?
}
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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