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

Jagrut_Patil_10's avatar
Jagrut_Patil_10
Icon for Nimbostratus rankNimbostratus
Aug 06, 2014

https redirection with URI Masking

.hello,

 

i'm new to F5 irule & need help to correct below requirement. Can someone please help us to complete https redirection with URI Masking. I have tried below irule which work for URI redirection with masking but webpage is getting converted to plain text instead greaphical view.

 

When user hit https://abc.com , it should be redirected to https://abc.com/abc/ but irule need to implement in such a way that it should not display the complete URL in the browser.

 

when HTTP_REQUEST {

 

Check if requested URI is / and requested host is abc.com if {[HTTP::uri] eq "/" and [string tolower [HTTP::host]] eq "abc.com" } { Rewrite URI to /abc/

 

HTTP::uri "/abc/"

 

}

 

}

 

Thanks in advance..

 

3 Replies

  • if {[HTTP::host] eq "abc.com"} {
      if {[HTTP::uri] eq "/"} {
        HTTP::uri "/abc/"
      }
    }
    

    The rewriting of the URI should in no way affect the content that is returned by the webserver. As long as the same content is in /abc/ then it should work fine. You may need to check your webserver configuration to ensure certain filetypes (php etc) will be recognised in the new directory because of possible security restrictions.

  • i have tried with below irule, but getting same plain test page..

     

    when HTTP_REQUEST { if {[HTTP::uri] equals "/"} { HTTP::uri "/" } HTTP::header replace "Host" "abc.com"

     

    if {[HTTP::uri] equals "/"} { HTTP::redirect "https://abc.com/abc" } }

     

  • Jagrut,

     

    please try this:

     

    when HTTP_REQUEST {

     

    switch [HTTP::host] {

     

    abc.com {

     

    if { [HTTP::uri] equals "/" }{

     

    HTTP::uri "/abc"

     

    }

     

    }

     

    }