Forum Discussion
david_wang_2073
Aug 05, 2006Historic F5 Account
http::redirect based on [LB::server addr]
Hi, All,
We are trying to do rtsp load balancing with redirect method, but the rtsp servers were located in different data center and not belong to the same subnet with BIG-IP.
The rtsp server will be chosen by BIG-IP with dynamic ratio method.
Now my question is that, after a rtsp server was selected, how can BIG-IP rediect the rtsp request.
I did a very simple test with irule as below:
when HTTP_REQUEST {
log local0. "in HTTP_REQUEST [HTTP::uri]"
}
when LB_SELECTED {
log "Selected server is [LB::server addr]"
HTTP::redirect "rtsp://www.yxsx.com/vod/shipin1_isdn.rm"
}
But I got following error message:
01070151:3: Rule [http_redirect] error: line 8: [command is not valid in current event context LB_SELECTED] [HTTP::redirect rtsp://www.yxsx.com/vod/shipin1_isdn.rm ]
It seem that http_redirect can not be used in LB_SELECTED.
Anybody has idea how to solve this problem?
Thanks,
David Wang
4 Replies
- david_wang_2073Historic F5 AccountI change the irule to below
when HTTP_REQUEST {
log local0. "in HTTP_REQUEST [HTTP::uri]"
}
when LB_SELECTED {
set server_addr [LB::server addr]
log "Selected server is [LB::server addr]"
node 192.168.20.3 80
clientside {TCP::respond "HTTP/1.1 302 Found\r\nLocation: rtsp://www.yxsx.com/vod/shipin1_isdn.rm\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"}
LB::detach
}
now redirect can be done in LB_SELECTED event. But the request from client side was still sent to the pool membber, but I hope all the requests from client side can be sent to 192.168.20.3.
The node 192.168.20.3 is not a server in the pool to be selected.
I used tcpdump to capture packet in internal vlan and found the request from client side were still sent to the server in the pool instead of 192.168.20.3.
How should I change my rule to do it? - david_wang_2073Historic F5 Accountsorry, it turns out that the irule I just post can not work. Anybody has idea how to implement it, I would highly appreciate.
- david_wang_2073Historic F5 AccountI still have not found a way to do redirect in LB_SELECT, so I have to do it in SERVER_CONNECTED, which means that client have to setup a connection with a real server before the a redirect packet is returned.
when SERVER_CONNECTED {
log "server connected event"
log "Selected server is [LB::server addr]"
TCP::collect
TCP::payload replace 0 [TCP::payload length] "RTSP/1.0 302 Found\r\nLocation: rtsp://www.yxsx.com/vod/shipin1_isdn.rm\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"
} - Deb_Allen_18Historic F5 AccountHi David -
If you simply want to redirect all traffic to a different data center by URI, you can issue the redirect in HTTP_REQUEST::
If instead you want to proxy the request to pool members that are in different data centers from the BIG-IP, there are a couple of ways to accomplish that, depending on your architecture... Post back if that's what you're after.when HTTP_REQUEST { log local0. "in HTTP_REQUEST [HTTP::uri]" HTTP::redirect "rtsp://www.yxsx.com/vod/shipin1_isdn.rm" }
/deb
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
