Forum Discussion
Redirection based on pool member
Fist of all apologize for my lack of knowledge. I need to redirect to different URL based on pool member balanced (it's not possible to do it on server side). For example:
- Pool_Member_1 --- redirected to ---
- Pool_Member_2 --- redirected to ---
Many thanks in advance. :)
2 Replies
If you really did mean redirect, and not rewrite, this might do the trick (not tested):
when LB_SELECTED { if { [IP::addr [LB::server addr] equals 192.168.1.1] } { HTTP::respond 302 Location "https://www.hostname1.com/extension" } else { HTTP::respond 302 Location "https://www.hostname2.com/extension" } }Seems like a funny thing to do, but who am I to judge without knowing the background. 🙂
Change to 301 from 302 if you want to make the redirect permanent.
/Patrik
And if you wanted to do a rewrite this should do the trick (still not tested):
when LB_SELECTED { HTTP::uri "/extension" if { [IP::addr [LB::server addr] equals 192.168.1.1] } { HTTP::host "www.hostname1.com" } else { HTTP::host "www.hostname2.com" } }/Patrik
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