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. :slight_smile:

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. :slightly_smiling_face:

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