Forum Discussion

EJL_104429's avatar
EJL_104429
Icon for Nimbostratus rankNimbostratus
Nov 30, 2007

Complicated Redirect for Peoplesot

Hello,

 

 

I'm having trouble wrapping my head around how to do the following:

 

 

Users will be requesting http://peoplesoft

 

 

And need to be redirected to one of the two servers, each service has a different URI, and port:

 

 

https://psprdweb01.acme.com:9601/psp/HRPRD1/?cmd=login

 

https://psprdweb01.acme.com:9602/psp/HRPRD2/?cmd=login

 

https://psprdweb02.acme.com:9603/psp/HRPRD3/?cmd=login

 

https://psprdweb02.acme.com:9604/psp/HRPRD4/?cmd=login

 

 

This does not work, but is the right idea:

 

 

when LB_SELECTED {

 

if { [HTTP::uri] equals "/" } {

 

switch [LB::server port] {

 

9601 { HTTP::redirect

 

"https://psprdweb01.acme.com:9601/psp/HRPRD1/?cmd=login" }

 

9602 { HTTP::redirect

 

"https://psprdweb01.acme.com:9602/psp/HRPRD2/?cmd=login" }

 

9603 { HTTP::redirect

 

"https://psprdweb02.acme.com:9603/psp/HRPRD3/?cmd=login"}

 

9604 { HTTP::redirect

 

"https://psprdweb02.acme.com:9604/psp/HRPRD4/?cmd=login"}

 

}

 

}

 

}

 

 

Any help would be great...

3 Replies

  • When you say it doesn't work, what do you mean? What does the client see in the browser? Do you see any errors in the /var/log/ltm log file?

     

     

    Aaron
  • It looks like the wiki page for HTTP::redirect is correct then, that HTTP::redirect isn't allowed in the LB_SELECTED event. I got an invalid action error when trying it:

    011f0007:3: http_process_state_prepend - Invalid action EV_SINK_HEADER during ST_HTTP_PREPEND_HEADERS

    I'm not sure why this happens as I didn't think a serverside connection had been established in LB_SELECTED.

    I tried this:

    
    when LB_SELECTED {
       if { [HTTP::uri] equals "/" } {
          switch [LB::server port] {
             80 { 
                 clientside {HTTP::redirect "https://psprdweb01.acme.com:9601/psp/HRPRD1/?cmd=login"}
                HTTP::redirect "https://psprdweb01.acme.com:9601/psp/HRPRD1/?cmd=login"
             }
          }
       }
    } 

    And this:

    
    when HTTP_REQUEST_SEND {
       if { [clientside {HTTP::uri}] equals "/" } {
          switch [LB::server port] {
             80 { 
                clientside {HTTP::redirect "https://psprdweb01.acme.com:9601/psp/HRPRD1/?cmd=login"}
             }
          }
       }
    } 

    ...but still get the error. I have a faint memory of running into this problem a while back, but can't remember if there was a solution.

    Does anyone else have ideas on how you can send a redirect back to the client based on the load balancing decision made in LB_SELECTED?

    By the way, do you actually have virtual servers set up for each of the four host names/port combinations? As an alternative, could you keep the client requesting the same external hostname, but rewrite the host header based before the request is send to the node? You'd probably also need to rewrite the Location header in HTTP redirects as well as any absolute references to the four hostnames in the HTTP content.

    Aaron