Forum Discussion
Redirect to another Pool
Hi Guys,
Quick question, as I am kind of new to irules, but have done plenty but just can't seem to get this request to work.
Here Goes:
User has a url --https://www.abc.com/rd/ui/ pool A and needs that redirected to https://www.abc.com pool B
problem is - first url from my multiple irules direct to pool B as expected via 302 location. The problems is that I am having trouble getting pool A, which is what they want from the redirect to utilize. Pool B is sort of the default and it redirects fine, but unable to get pool B going. Here is the latest in many that I have tried:
elseif { ($requestURI starts_with "/rd/")} { HTTP::respond 302 location "; TCP::close } elseif {($requestURI equals "/")} { pool ext_B pool }
Any assistance would be greatly appreciated.
- brad_11480Nimbostratus
your code is not too complete as it starts with 'elseif'.. so not clear.
elseif { ($requestURI starts_with "/rd/")} { HTTP::respond 302 location "https://www.abc.com/"; TCP::close } elseif {($requestURI equals "/")} { pool ext_B pool }
You seem to be doing two things: First redirecting path starting with /rd/ to the root path, and then second allocating the resource depending on the path.
Is it that you want anything starting with /rd/ to go to poolB and that it should also all be on the root path of poolB? ANything else goes to poolA? I would do that without any redirect..
if { $requestURI starts_with "/rd/" } { HTTP::path "/" pool poolB }
Make the virtual server default pool poolA. So everything would go to poolA unless the path starts with /rd/. In that case it would use poolB and replace the path with the root path on that pool of servers.
- socar65Nimbostratus
Brad,
That's exactly what I want to do, pool B should catch everything except the root stuff in pool A/default really. Thanks Brad, let me try it without the redirect to test and see.
Thanks Much!!
- socar65Nimbostratus
Brad,
The non redirects work, which still end up at the requested url page. Let me be clear again on what they are trying to do.
First--- anyone/user who types https://www.abc.com/rd/ui which has a pool A itself. That url they want to automatically redirect to https://www.abc.com default page which has pool B.
The redirect works great to https://www.abc.com. but it opens up it's pool b page and I need that redirect to open up pool A page.
Again, the non-redirect works great! If this is not possible, I am ok with that. I have tried numerous rulesets to kick off Pool A with the redirect, but have not been successful.
Thanks
- brad_11480Nimbostratus
I think it would help if you could provide examples as I still don't understand what you need. maybe list a few examples and where you want it to end up..
or fill in the blank
- should go to pool ???
- should go to pool ???
in any case do you want the path changed from one path to another? If so what cases should that happen?
- should be changed to path ???
- should be changed to path ???
- should be changed to path ???
- socar65Nimbostratus
goes to default pool B www-abc.com/rd/ui goes to pool A that's the entire path
path should change to path but use pool A
EX: if { ($requestURI starts_with "/rd/ui/")} { HTTP::uri [string map {/rd/ui/ " /"/} {requestURI] pool ext_servername_pool HTTP::redirect "http://www-abc.com[HTTP::uri]"
Another Ex if { ($requestURI starts_with "/rd/ui/")} { HTTP::respond 302 location "http://www-abc.com/' TCP::close return } else { pool ext_servernamer_pool }
- brad_11480Nimbostratus
Then set your default path to poolB and all paths will go there except for the one in the irule. your example seems in line.. synatax on the string map and you won't need a redirect.
if { ($requestURI starts_with "/rd/ui/")} { HTTP::uri [string map "/rd/ui/ /" $requestURI] pool ext_servername_pool
the string map will replace /rd/ui/ with a / and set the URI to that result it will then switch to pool ext_servername_pool in place of the default pool if you then issued a redirect it would process the iRule again and end up in the default pool.
good luck.
- socar65Nimbostratus
Thanks Brad --- I will give it a shot.
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