Forum Discussion

Pandiarajan_701's avatar
Pandiarajan_701
Icon for Nimbostratus rankNimbostratus
Jun 24, 2012

HTTPS >>> HTTP Redirect

Hi,

 

 

We have a redirection configured for the URL http://stp.xxx.com.sa as below which is working fine.

 

 

 

when HTTP_REQUEST {

 

if { [HTTP::host] eq "stp.XXX.com.sa" } { pool ST_Proxy_9080_Pool }

 

}

 

 

 

 

 

 

Now we need to redirect all the HTTPS pages of this URL to HTTP page below are some pages.

 

 

 

https://stp.xxx.com.sa/stwebclient/index.jsp >>> http://stp.xxx.com.sa/stwebclient/index.jsp

 

https://stp.xxx.com.sa/stbaseapi/baseComps.js?lang=ar >>> http://stp.xxx.com.sa/stbaseapi/baseComps.js?lang=ar

 

 

 

Could someone advise on how to do this redirection.

 

3 Replies

  • Is there a reason you aren't using httpclass profiels to do this? That's *exactly* the kind of thing they are for:

     

     

    profile httpclass redirect_to_http_uri_class {

     

    defaults from httpclass

     

    redirect "http://[HTTP::host][HTTP::uri]"

     

    }

     

  • in case you would like to try irule. additionally, you may put url into data group and use class match command in irule instead of hard-coding url in the irule as following.

    [root@ve1024:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:443
       ip protocol 6
       rules myrule
       profiles {
          clientssl {
             clientside
          }
          http {}
          tcp {}
       }
    }
    [root@ve1024:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       switch [HTTP::uri] {
          "/stwebclient/index.jsp" -
          "/stbaseapi/baseComps.js?lang=ar" {
             HTTP::redirect http://[HTTP::host][HTTP::uri]
          }
       }
    }
    }
    
    [root@ve1024:Active] config  curl -Ik https://172.28.19.79/stwebclient/index.jsp -H "Host:stp.xxx.com.sa"
    HTTP/1.0 302 Found
    Location: http://stp.xxx.com.sa/stwebclient/index.jsp
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve1024:Active] config  curl -Ik https://172.28.19.79/stbaseapi/baseComps.js?lang=ar -H "Host:stp.xxx.com.sa"
    HTTP/1.0 302 Found
    Location: http://stp.xxx.com.sa/stbaseapi/baseComps.js?lang=ar
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0