Forum Discussion

bertrand_9354's avatar
Icon for Nimbostratus rankNimbostratus
Jan 27, 2012

rewriting location header from server

Hi everybody,



I have an application on which my client connect to F5 on https and the F5 decrypt to server. The problem is my server (in response) is sending to F5 for each request an301 redirect and so the F5 is not able to analyze it: For example I did a curl on server with the host:


curl -v x.x.x.x -H


* About to connect() to x.x.x.x port 80


* Trying x.x.x.x ... connected


* Connected to x.x.x.x ( x.x.x.x ) port 80


> 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: x.x.x.x


> Accept: */*






< HTTP/1.1 301 Redirection


< Server: WEB-Access-Server/1.9


< Date: Fri, 27 Jan 2012 17:09:32 GMT


< Content-type: text/html


< Content-length: 457


< Location: http://toto/index.htm


< Connection: Keep-Alive


Error 301





HTTP Error 301


301 Redirection



Vous allez être redirigé vers



Contactez l'administrateur du serveur si ce problème persiste.




* Connection 0 to host x.x.x.x left intact


* Closing connection 0




As you can see there is a 301 redirect with a different Location.


I tried to change this irules:




if { [HTTP::is_redirect] } {


STREAM::expression {@http://@https://@}









Thks for your help,








5 Replies

  • Hi Bertrand,



    You can use a custom HTTP profile with rewrite redirects enabled to have TMM rewrite the redirect to https://.



  • Also, the stream profile only affects payloads. If you wanted to do this rewrite in an iRule, you'd want to use HTTP::header:





  • e.g.


    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       ip protocol 6
       profiles {
          clientssl {
          http {}
          tcp {}
    [root@ve1023:Active] config  b pool foo list
    pool foo {
       members {}
    [root@ve1023:Active] config  curl -Ik
    HTTP/1.1 302 Found
    Date: Mon, 30 Jan 2012 14:56:58 GMT
    Server: Apache/2.2.3 (CentOS)
    Location: http://toto/index.htm
    Content-Type: text/html; charset=iso-8859-1
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_RESPONSE {
            if {[HTTP::is_redirect]}{
                    HTTP::header replace Location [string map {"http://toto" ""} [HTTP::header Location]]
    [root@ve1023:Active] config  b virtual bar rule myrule
    [root@ve1023:Active] config  curl -Ik
    HTTP/1.1 302 Found
    Date: Mon, 30 Jan 2012 14:57:15 GMT
    Server: Apache/2.2.3 (CentOS)
    Content-Type: text/html; charset=iso-8859-1