This might have already been asked, but I cannot find it…
I have four media caching servers at four different locations. I need an irule that checks the source IP of the HTTP request and redirects them to their local media caching server. I am very new to this and have only ever done http/hhtps redirects.
Example: mms://media.url/newVideo1 →
Source ip = 10.10.1.0/24 -> mms://10.10.local/newVideo1
Source ip = 10.8.1.0/24 -> mms://10.8.local/newVideo1
Ultimately I just want to change the first part of the URL, but leave the filename the same.
THank you in advance.
You should be able to use the
IP::client_addr
command to get the client ip address and check that against addresses manually or use a data group to handle that (then you can set the node manually)
Manual check and set to node
when HTTP_REQUEST {
if {[IP::addr [IP::client_addr] equals 10.10.1.0/24]} {
node 10.1.1.1
} elseif {[IP::addr [IP::client_addr] equals 10.8.1.0/24]} {
node 10.8.1.1
}
}
You could also use a datagroup to handle the client ip and destination ip:
Check against datagroup
when HTTP_REQUEST {
if { [class match [IP::client_addr] equals ADDR_DATAGROUP] } {
node [class match -value [IP::client_addr] equals ADDR_DATAGROUP]
}
}
Hope this helps.
Will either of these methods change only the host & domain portion of the url? I don’t want to change the filename section. Otherwise I will have to update this rule every time they create a new video.
No. it should only set which backend node the request gets sent to. the filename shouldn’t be altered.