Forum Discussion
hooleylist
Nov 30, 2007Cirrostratus
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