Forum Discussion
irule for request and response
So, I got some direction...
Here are the three possible paths :
/x
/y
/z
Each could have another resource behind the initial path i.e. /x/ping or /x/file or z/path or z/box.
The other resource /ping or /file or /path or /box is what I don't know will be called but needs to be requested to the server and /x, /y, or /z needs to be edited out and only the second resource needs to be sent to server.
So user puts in /x/ping and /ping gets request to server.
Similarly, when the response is sent back the first resource needs to be added back. As in if we called /x/ping, x would be add back from the server that only was called /ping.
So.. all that written, let me see how to apply the below with x.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/x/1" } {
#Comment:The string map is used to replace the uri value from /uri/1 to /uri/2.
HTTP::uri [string map {"/x/1/" "/x/2"} [HTTP::uri]]
pool pool_x
}
when HTTP_RESPONSE {
if { [HTTP::uri] starts_with "/x/2" } {
HTTP::uri [string map {"/x/2/" "/x/1"} [HTTP::uri]]
}
So, with the three first resources - x, y, z - and this all being one virtual server, would I just create three irules and apply them all to the one virtual server?
Happy Irulz Friday.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
