Forum Discussion
minnoce944
Nimbostratus
Oct 01, 2007rewrite URI syntax
Hi there I'm new to i-rules and to the F5 product line in general. I have a VIP that needs to rewrite (not redirect) the URI based on the sub-domain.
I'm using ver BIG-IP 9.2.3 Build 34.8
Example:
http://app1.company.com --> http://application.company.com/app1.html
Example 2:
http://app2.company.com --> http://application.company.com/app2.html
Can the group provide a i-rule that can accomplish this?
Appreciate the help.
Thanks,
--minnoce944
4 Replies
- Patrick_Chang_7Historic F5 AccountTry looking at the HTTP::host and HTTP::uri entries in the iRules Wiki section. Alternatively, you could make use of F5's iRules on demand service.
- minnoce944
Nimbostratus
my understanding from searching and reading thru other examples is:
if i wanted to do a redirect:
when HTTP_REQUEST {
if { [HTTP::host] == "app1.company.com" } {
HTTP::redirect "http://applications.company.com/app1.html"
}
}
when HTTP_REQUEST {
if { [HTTP::host] == "app2.company.com" } {
HTTP::redirect "http://applications.company.com/app2.html"
}
}
if i wanted to do a rewrite
when HTTP_REQUEST {
if { [HTTP::host] == "app1.company.com" } {
HTTP::host "applications.company.com" and HTTP::uri "/app1.html"
}
}
when HTTP_REQUEST {
if { [HTTP::host] == "app2.company.com" } {
HTTP::host "applications.company.com" and HTTP::uri "/app2.html"
}
}
i wasn't sure if there was a HTTP::rewrite or if i had to use the replace keyword or not?
This look right to the group?
Let me know.
Thanks in advance for your help.
--minnoce944 - Patrick_Chang_7Historic F5 Account
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
switch [HTTP::host] {
"app1.company.com" { HTTP::redirect "http://app1.company.com/app1.html" }
"app2.company.com" { HTTP::redirect "http://app2.company.com/app1.html" }
}
}
} - minnoce944
Nimbostratus
Thank you pchang and Joe. The redirect worked exactly as expected. Appreciate the help. Take care.
--minnoce944
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
