Forum Discussion
sundogbrew
Altocumulus
Mar 26, 2013irule to pick a number out of a URI and make it the port
I have developers who want to tie everything off the same URL and have it go to different ports on the same group of hosts. If you have been following my posts, it is almost the exact opposite probl...
What_Lies_Bene1
Cirrostratus
Mar 26, 2013It's not ideal but if you configure multiple Pools accordingly, with the Pool name ending in the port number it supports then the following pretty short rule should work as long as a four digit port number is always used. It is probably worth adding in some checks to ensure you have a valid value before rewriting the URI and Host and specifying the Pool.
when HTTP_REQUEST {
Find the first / in the URI, skip 4 characters and match the rest of the string, set this as variable newuri
set newuri [findstr [HTTP::uri] "/" "4"]
Find the first / in the URI, skip 0 characters and match until the next /, this this as variable newport
set newport [findstr [HTTP::uri] "/" "0" "/"]
Change the URI before we send this request to a real server
HTTP::uri "$newuri"
Change the HTTP Host header
HTTP::header replace Host "[HTTP::host]:$newport"
Use the relevant Pool
pool pool_$newport
}
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
