Forum Discussion

Mr_777_63981's avatar
Mr_777_63981
Icon for Nimbostratus rankNimbostratus
Apr 06, 2012

Redirection Issues

Hi everyone,

 

i am facing a problem and unable to solve it. I hope someone will help me solving this issue.

 

 

Let me explain the scenario.

 

 

In Data Group Members i have two lists say Secure and UnSecure, both of these have the URL patterns. Let's see the contents of these two lists.

 

 

Secure:

 

/abc

 

/x/ghj

 

httpsecure=y

 

httpsecure=Y

 

 

UnSecure:

 

/abc

 

/x/ghj

 

httpsecure=y

 

httpsecure=Y

 

 

In iRules i have two files again named Secure and UnSecure.

 

 

 

Secure:

 

when HTTP_REQUEST {

 

// Here is an if condition that actually looks if the request(url pattern) is in the UnSecure List. //If it's not, below line executes

 

HTTP::redirect https://[HTTP::host][HTTP::uri]

 

}

 

}

 

 

UnSecure:

 

when HTTP_REQUEST {

 

// Here is an if condition that actually looks if the request(url pattern) is not in the UnSecure List. //If it's not, below line executes

 

HTTP::redirect https://[HTTP::host][HTTP::uri]

 

}

 

}

 

 

 

Now, if i land on /x/ghj page, it takes me to the https but as soon as i get back to another page say /zxcv, it keeps me on https. Can anyone kindly help me how can i redirect myself to http once i go to /zxcv from /x/ghj

 

 

 

I am looking for help and hope i will get it.

 

 

Regards...

 

 

1 Reply

  • not sure if i understand correctly. is it something like this?

    [root@ve1023:Active] config  b virtual bar80 list
    virtual bar80 {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules rule80
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b class Secure list
    class Secure {
       {
          "/abc"
          "/x/ghj"
          "httpsecure=Y"
          "httpsecure=y"
       }
    }
    [root@ve1023:Active] config  b rule rule80 list
    rule rule80 {
       when HTTP_REQUEST {
            if { [class match -- [string tolower [HTTP::uri]] contains Secure] } {
                    HTTP::redirect "https://[HTTP::host][HTTP::uri]"
            }
    }
    }
    
    [root@ve1023:Active] config  b virtual bar443 list
    virtual bar443 {
       snat automap
       pool foo
       destination 172.28.19.79:443
       ip protocol 6
       rules rule443
       profiles {
          clientssl {
             clientside
          }
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b rule rule443 list
    rule rule443 {
       when HTTP_REQUEST {
            if { not [class match -- [string tolower [HTTP::uri]] contains Secure] } {
                    HTTP::redirect "http://[HTTP::host][HTTP::uri]"
            }
    }
    }
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79/x/ghj/something
    HTTP/1.0 302 Found
    Location: https://172.28.19.79/x/ghj/something
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve1023:Active] config  curl -Ik https://172.28.19.79/zxcv/something
    HTTP/1.0 302 Found
    Location: http://172.28.19.79/zxcv/something
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0