Forum Discussion
URL Redirect based on site IP
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.
3 Replies
- Michael_Jenkins
Cirrostratus
You should be able to use the
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)IP::client_addrManual 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.
- Kris_Peters_140
Nimbostratus
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.
- Michael_Jenkins
Cirrostratus
No. it should only set which backend node the request gets sent to. the filename shouldn't be altered.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
