Forum Discussion

TJ_Vreugdenhil's avatar
Mar 13, 2012

HTTPS Redirect datagroup

http://www.domain.com/online/index.cfm?template=text

 

 

http://www.domain.com/online/index.cfm?template=receive_alerts

 

 

http://www.domain.com/privacy/index.cfm?template=learn_about

 

 

I'm just looking to send these three URL's to unique new HTTPS URL's. There are no https:// URL's configured for these URL's on the server. Each HTTP URL will be sent to a unique HTTPS URL. (the HTTPS URL's are undetermined at this point).

 

 

Is is possible to match on a user string (?), or can I just match by 'httpuri'.(template=xxxx)

 

 

Is there someway I can do this with a datagroup? Can someone please provide a sample iRule?

 

 

Much Thanks!

 

  • 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 class template_dg list
    class template_dg {
       {
          "learn_about"
          "receive_alerts"
          "text"
       }
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
            if {[class match -- [URI::query "?&[HTTP::query]" template] equals template_dg]}{
                    HTTP::redirect "https://www.abc.com/"
            }
    }
    }
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79/online/index.cfm?template=text
    HTTP/1.0 302 Found
    Location: https://www.abc.com/
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79/online/index.cfm?template=receive_alerts
    HTTP/1.0 302 Found
    Location: https://www.abc.com/
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79/online/index.cfm?template=learn_about
    HTTP/1.0 302 Found
    Location: https://www.abc.com/
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79/online/index.cfm?template=somethingelse
    HTTP/1.1 404 Not Found
    Date: Tue, 13 Mar 2012 15:21:38 GMT
    Server: Apache/2.2.3 (CentOS)
    Content-Type: text/html; charset=iso-8859-1