Forum Discussion

Mike_Breeden_62's avatar
Mike_Breeden_62
Icon for Nimbostratus rankNimbostratus
May 28, 2014

Redirect Client based on datagroup and mask URI

I have a request from the business to redirect clients to different uri based on if their ip matches a datagroup and if not then it will not redirect or rewrite the uri.

 

Here is what I have so far but I cannot get it to work properly unless I do the redirect. The one that rewrites the uri does not bring up the full page.

 

when HTTP_REQUEST {

 

if {([HTTP::host] equals "site.mike.net") and ([HTTP::uri] equals "/")} { if {[ class match [IP::client_addr] equals "Datagroup_S"]} { Site does not load fully with uri rewrite HTTP::uri "/Site1/SE.aspx"

 

} elseif {[ class match [IP::client_addr] equals "Datagroup_M"]} {

 

Site loads properly but new uri is exposed

HTTP::redirect "/Site1/default.aspx" } else { HTTP::uri "/default.aspx" } } }

 

5 Replies

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    1. The redirect has a location of /default.aspx. I'm not sure if this is just a Proof of Concept, but generally you'd want to just redirect to /.
    2. Are there any dependencies in the .NET-code (or HTML-code) that might get confused if the level of the containing folder is different? If it's in the HTML you would see 404s (or if .NET still has the default configuration, 302s followed by 200s).
  • Here is what I have so far but I cannot get it to work properly unless I do the redirect. The one that rewrites the uri does not bring up the full page.

     

    i think path in subsequent request (e.g. image, script, etc) will not be correct since you only rewrite default page uri.

     

    tcpdump on bigip or http analyzer tool (e.g. httpfox) may be helpful.

     

    HttpFox

     

    https://addons.mozilla.org/en-US/firefox/addon/httpfox/

     

  • I have got it to work but not with rewriting the URI. It only works when redirecting.

     

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    Which version of BIG-IP are you running?