For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

paul_dcc's avatar
paul_dcc
Icon for Nimbostratus rankNimbostratus
Sep 05, 2014

Redirect

Hi All,

 

I need to do a redirect to a server, which is ok;

 

when HTTP_REQUEST { if { [HTTP::host] equals "apps.dev.geowessex.com" and [HTTP::uri] contains "/explorer" } { log local0. "Redirected based on hostname and URI" HTTP::redirect "https://explorer.dev.geowessex.com"} }

 

But what the customer wants is to be able to do the redirect, but keep the original browser info i.e. https:// apps.dev.geowessex.com/explorer is this possible ?

 

Many Thanks

 

Paul

 

5 Replies

  • can you try something like this?

    e.g.

     config
    
    root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar
    ltm virtual bar {
        destination 172.28.24.10:80
        ip-protocol tcp
        mask 255.255.255.255
        pool foo
        profiles {
            http { }
            tcp { }
        }
        rules {
            qux
        }
        source 0.0.0.0/0
        source-address-translation {
            type automap
        }
        vs-index 7
    }
    root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm pool foo
    ltm pool foo {
        members {
            200.200.200.101:80 {
                address 200.200.200.101
            }
        }
    }
    root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule qux
    ltm rule qux {
        when HTTP_REQUEST {
      if { [HTTP::host] equals "apps.dev.geowessex.com" and [HTTP::path] starts_with "/explorer" } {
        HTTP::header replace Host "explorer.dev.geowessex.com"
        HTTP::uri [string map {"/explorer" ""} [HTTP::uri]]
        node 200.200.200.111
      }
    }
    }
    
     trace
    
    [root@ve11a:Active:In Sync] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 100.100.100.28(39498) <-> 172.28.24.10(80)
    1409906668.3057 (0.0049)  C>S
    ---------------------------------------------------------------
    GET /explorer/something HTTP/1.1
    User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.1h zlib/1.2.3 libidn/0.6.5
    Accept: */*
    Host: apps.dev.geowessex.com
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.14(39498) <-> 200.200.200.111(80)
    1409906668.4753 (0.1675)  C>S
    ---------------------------------------------------------------
    GET /something HTTP/1.1
    User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.1h zlib/1.2.3 libidn/0.6.5
    Accept: */*
    Host: explorer.dev.geowessex.com
    
    ---------------------------------------------------------------
    
  • Hi Nitass,

     

    Will this work on ASM as that's what I'm using ? and is there a more simpler way of doing it ?

     

    Many Thanks

     

  • Hi Nitass,

     

    What I’m trying to do is this;

     

    User puts https://apps.dev.geowessex.com/explorer (195.49.180.209) in there browser, I want this to remain in there browser but then re point them to an internal server (172.17.32.143) and put this in explorer.dev.geowessex.com because this is the correct information so this server will respond correctly.

     

    But I have to maintain for the user this in the browser https://apps.dev.geowessex.com/explorer

     

    So to maintain this in the browser could you not rewrite the response back to always use this?

     

    Simple redirects I can do via an Irule but I don’t have the knowledge to right one to do this.

     

  • So to maintain this in the browser could you not rewrite the response back to always use this?

     

    there is no url in response. you may try http analyzer tool to see how request and response look like.

     

    HttpFox

     

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

     

    But I have to maintain for the user this in the browser https://apps.dev.geowessex.com/explorer

     

    to not change url in browser but url sending to server, you can use HTTP::header (to change host header) and HTTP::uri (to change uri) commands. what i posted is just an example. it may not fully work due to web application behavior. in that case, you may have to capture packet and see what wrong is.

     

    sol10209: Overview of packet tracing with the ssldump utility

     

    http://support.f5.com/kb/en-us/solutions/public/10000/200/sol10209.html

     

    hope this helps.