irule for redirecting to VIP with uri
i have a server in internal segment which needs to be accessed by both internal and external users. i want to create a virtual server which will be exposed over internet which should redirect me to this internal server with a uri appending to it. ex: if my internal server is 10.1.1.1 and i have a page which needs to be displayed ex: http://10.1.1.1/admin to internal users coming from 10.0.0.0/8 segment and i have another page http://10.1.1.1/external which will be displayed to internet users. I will be exposing my virtual server ip but not the internal Ip. Is it possible to do this?? i tried the below but there is a redirect loop.
when HTTP_REQUEST { if { ([HTTP::uri] contains "/")}{ if { ( [IP::addr [IP::client_addr] equals 10.0.0.0/8]) }{ HTTP::redirect http://public-ip-of-virtualserver/admin } else {HTTP::redirect http://public-ip-of-virtualserver/external} } }
Please help. Thanks in advance.