For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

JTucker_137331's avatar
JTucker_137331
Icon for Nimbostratus rankNimbostratus
Feb 12, 2015

set Response_Redirect Question

Hi,

We have a Wordpress site that I would like to redirect requests for the admin pages to another location, I have an iRule that looks like this:

when HTTP_REQUEST priority 10 {
     unset -nocomplain request_already_responded


    switch -exact -- [string tolower [HTTP::path]] "/wp-admin"  - \
                                                   "/wp-login.php" {

    set Response_Redirect "http://www.asite.com/"

} default {

        set Pool_Name Pool_Live_newsroom_HTTP80

    } 
} 

Where the URL is:

blog.asite.com/en/xxx/

Its pretty simple so I am wondering what on earth is wrong with it!

Thanks in Advance

James

3 Replies

  • Your current iRule does not do anything besides consuming memory. Are you sure you've pasted everything?

    Try something as below:

    when HTTP_REQUEST {
    
        switch -glob [HTTP::uri] {
          "*/wp-admin" -
          "*/wp-login.php" {
            HTTP::respond 302 location "http://www.asite.com/"
            event disable
            TCP::close
             Forces a temp redirect to a given location (non-cacheable). Instructs F5 to stop processing the HTTPrequest event. The TCP connection record will be removed from the connections table.
          } default {
            pool Pool_Live_newsroom_HTTP80
             Instructs F5 to select a pool specified. Assuming this is the same as your VS default pool, this section can be removed from the iRule.
          }
        }
    }
    
  • Hi,

     

    I will give that a shot, apart from some comments yes, that is all, none of the VS's have a default pool, it's all handled by the iRule.