Forum Discussion
AngryCat_52750
Nimbostratus
Feb 28, 2013Changing Hostnames and URIs
we are making a service call to an external vendor. We call - internal.apple.com/foo/bar/pear.svc and we make it vendor.example.com/foo/bar/pear.svc with a irule -
when HTTP_REQUEST {
HTTP::header replace Host "vendor.example.com"
}
Is there a way to make internal.apple.com/fruits to become vendor.example.com/foo/bar/pear.svc ???
5 Replies
- What_Lies_Bene1
Cirrostratus
There is, something like this will do exactly what you want (but won't modify other URIs, they must match exactly);when HTTP_REQUEST { HTTP::header replace Host "vendor.example.com" if { [string tolower [HTTP::uri]] equals "/fruits" } { [HTTP::uri] "/foo/bar/pear.svc" } } - nitass
Employee
i think the last HTTP::uri should not have brackets around.when HTTP_REQUEST { HTTP::header replace Host "vendor.example.com" if { [string tolower [HTTP::uri]] equals "/fruits" } { HTTP::uri "/foo/bar/pear.svc" } } - What_Lies_Bene1
Cirrostratus
Thanks Nitass, you are correct. =] - AngryCat_52750
Nimbostratus
Guys. instead of an if for the URI portion, could i do this instead?switch -glob [string tolower [HTTP::uri]] { "/fruits" { HTTP::uri "/foo/bar/pear.svc" } } - Michael_Yates
Nimbostratus
Hi kulastone,
You will need to add an "*" to the end of what you are comparing within a Switch Statement.
Starts with: "/fruits*" { do something }
Ends with: "*/fruits.html" { do something }
Contains: "*/fruits*" { do something }
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