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 28, 2010Can you try using a browser plugin to view the unencrypted HTTP requests and responses? You can use HttpFox for Firefox or Fiddler for IE.
I think you'll find that you're getting a redirect loop because requests to any URI for https://qa.ipcws.fiserv.com are being redirected to https://qa.ipcws.fiserv.com/cws.web/Login.aspx. One way to fix this is by redirecting all requests for www.qa.ipcws.fiserv.com to qa.ipcws.fiserv.com and only requests for qa.ipcws.fiserv.com and / to the login page:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]"
Check the requested host set to lowercase
switch [string tolower [HTTP::host]] {
"www.qa.ipcws.fiserv.com" {
Matched the host check, send a 301 with the new location
log local0. "[IP::client_addr]:[TCP::client_port]: Matched www.qa.ipcws.fiserv.com, redirecting to login page"
HTTP::respond 301 Location "https://qa.ipcws.fiserv.com/cws.web/Login.aspx"
}
"qa.ipcws.fiserv.com" {
Matched the host check, send a 301 with the new location for requests to /
if {[HTTP::uri] eq "/"}{
log local0. "[IP::client_addr]:[TCP::client_port]: Matched qa.ipcws.fiserv.com and /, redirecting to login page"
HTTP::respond 301 Location "https://qa.ipcws.fiserv.com/cws.web/Login.aspx"
}
}
default {
Take some default action?
log local0. "[IP::client_addr]:[TCP::client_port]: No match, doing nothing"
}
}
}
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