Forum Discussion

mike_61630's avatar
mike_61630
Icon for Nimbostratus rankNimbostratus
Jan 02, 2010

URI in HTTP_REQUEST_SEND

Hi,

 

 

I would like to know if It's possible to change the URI of a petition or do a redirection in "HTTP_REQUEST_SEND".

 

 

 

Thanks.

7 Replies

  • Hi Mike,

     

    I don't see any reason that the iRules won't let you change the URI or perform a redirection based on the HTTP_REQUEST_SEND even. You simply have to remember that HTTP_REQUEST_SEND is executed before it's sent to the server side of the TCP/IP stack. Here is a forum that talks about it.

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=31125

     

     

    I hope this helps

     

     

    Bhattman
  • I think you'll get a runtime TCL error trying to do a redirect (even in the clientside context) in the HTTP_REQUEST_SEND event. As Bhattman said, a URI rewrite will work fine though using clientside {HTTP::uri "/new/uri"}.

     

     

    Aaron
  • It works.

     

     

    I suppose that HTTP::redirect or HTTP::respond can't be done.

     

     

     

    Thanks.
  • That's correct. Neither HTTP::redirect or HTTP::respond work currently in the HTTP_REQUEST_SEND event either by design or due to a bug. You could open a case with F5 Support to find out which it is and possibly request that they add support for them.

     

     

    Aaron
  • e.g.

    [root@ve10:Active] config  b virtual bar80 list
    virtual bar80 {
       snat automap
       pool foo
       destination 172.28.19.252:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:80 {}
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST_SEND {
            clientside { HTTP::uri "/new/uri" }
    }
    }
    
    [root@ve10:Active] config  ssldump -Aed -nni 0.0 port 80
    New TCP connection 1: 172.28.19.251(46079) <-> 172.28.19.252(80)
    1357867394.9092 (0.0010)  C>S
    ---------------------------------------------------------------
    GET / 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: 172.28.19.252
    Accept: */*
    
    ---------------------------------------------------------------
    
    New TCP connection 2: 200.200.200.10(46079) <-> 200.200.200.101(80)
    1357867394.9113 (0.0010)  C>S
    ---------------------------------------------------------------
    GET /new/uri 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: 172.28.19.252
    Accept: */*
    
    ---------------------------------------------------------------