Forum Discussion
Sean_O_Brien_65
Nimbostratus
Feb 09, 2010url forward for http and https based on request
need an irule to forward to different url based on how the request came in...
example:
when HTTP_REQUEST {
if {[HTTP::host] equals "dev.domain1.com"}{
HTTP::redirect "http://dev-domain1.domain2.com"
}
}
I need to add to this another domain url that looks the same but is 'qa' instead of 'dev'.
also would like this single iRule to handle http -> https at the same time, if possible... It sure seems like that shouldn't be an issue.
I tried doing this with an if / else, but I guess I'm having issue getting the syntax correct, but it seems like that would work.
Given our dns, only these two url's would ever go to this VS address.
Thanks!
- hoolio
Cirrostratus
Hi Sean,when HTTP_REQUEST { Check the requested host header (set to lowercase) switch [string tolower [HTTP::host]] { "dev.domain1.com" { HTTP::redirect "http://dev-domain1.domain2.com" } "qa.domain1.com" { HTTP::redirect "http://qa-domain1.domain2.com" } default { Take some default action? Requests using the IP address would hit here } } }
- Sean_O_Brien_65
Nimbostratus
Awesome, thanks for the help! - hoolio
Cirrostratus
You could test this by adding host file entries on your client (/etc/hosts for *nix or c:\windows\system32\drivers\etc\hosts on Windows). - Sean_O_Brien_65
Nimbostratus
Posted By hoolio on 02/10/2010 8:32 AM
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