# Redirection Issues

**URL:** <https://community.f5.com/t/redirection-issues/39523>\
**Category:** Technical Forums\
**Tags:** dev, irules, devops, application-delivery\
**Created:** [April 6, 2012, 5:41pm UTC](https://community.f5.com/t/redirection-issues/39523 "2012-04-06T17:41:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_777\_63981](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Mr\_777\_63981](https://community.f5.com/u/Mr_777_63981)\
**Post date:** [April 6, 2012, 5:41pm UTC](https://community.f5.com/t/redirection-issues/39523/1 "2012-04-06T17:41:56Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![nitass](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/nitass/32/2270_2.png) [@nitass](https://community.f5.com/u/nitass)\
**Post date:** [April 7, 2012, 3:34am UTC](https://community.f5.com/t/redirection-issues/39523/2 "2012-04-07T03:34:20Z")

</div>

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

```tcl
[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

```
