Forum Discussion

mshisko_64433's avatar
mshisko_64433
Icon for Nimbostratus rankNimbostratus
Apr 20, 2012

Transparent URL redirect

I am trying to write an iRule that will rewrite the URL from a user request to a new URL and and a URI. The user will enter site.mydomain.com and be sent to newsite.newdomain.com/page1/page2... While this happens the displayed URL should not change and remain site.mydomain.com. The URI will update as users navigate the site.

1 Reply

  • e.g.

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:80 {}
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       if { [HTTP::host] equals "site.mydomain.com" and [HTTP::uri] equals "/" } {
          HTTP::header replace Host "newsite.newdomain.com"
          HTTP::uri "/page1/page2"
       }
    }
    }
    
    [root@ve1023:Active] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.19.251(54143) <-> 172.28.19.79(80)
    1334906654.4749 (0.0011)  C>S
    ---------------------------------------------------------------
    HEAD / HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: site.mydomain.com
    Accept: */*
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.10(54143) <-> 200.200.200.101(80)
    1334906654.4757 (0.0007)  C>S
    ---------------------------------------------------------------
    HEAD /page1/page2 HTTP/1.1
    User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
    Host: newsite.newdomain.com
    Accept: */*
    
    ---------------------------------------------------------------