Forum Discussion

luyenntk50db_14's avatar
luyenntk50db_14
Icon for Nimbostratus rankNimbostratus
Nov 13, 2018

Irule for https://abc/NEWS/ in F5

Step 1:

I configured one Virtual Server (IP: a.b.c.d; port 443), using SSL Offloading. My confiruring target is when i enter in Web Browser , it'll redirect to I used this irule (http-append) as below:

 

when HTTP_REQUEST {

 

if {([HTTP::path] == "/") } { HTTP::redirect "https://[HTTP::host][HTTP::uri]NEWS" } }

 

After I used this irule, i don't access to ; after i enter Web Browser , it redirected to

 

Step 2:

And when I added one Virtual Server (IP:a.b.c.d; port 80), using the irule as below:

 

when HTTP_REQUEST { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }

 

After using this irule, I access to .

 

Pls explain to me. And I want to use only Virtual Server and only irule to redirect from to

 

5 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus

    Please put code blocks around your iRule fragment to make it readable. A readable question will always gather more answers

     

  • Hi,

    Please try the below iRule

       when HTTP_REQUEST {
        if {[HTTP::host] equals "abc" }{ 
        HTTP::uri "/NEWS/"
        }
       }
    
  • Hi,

    Please try the below iRule

       when HTTP_REQUEST {
        if {[HTTP::host] equals "abc" }{ 
        HTTP::uri "/NEWS/"
        }
       }
    
  • Dear Nandhini Natarajan,

     

    I used your iRule, but it's not running. Pls read my question, I want to use only Virtual server and only iRule. Pls guide me.

     

    Thanks for your answer!

     

  • Snl's avatar
    Snl
    Icon for Cirrostratus rankCirrostratus

    Give this a try

    Apply below irule on VS-443 , VS-80 apply default sys_https_redirect irule

    when HTTP_REQUEST {
        if { [HTTP::uri] equals "/" } {
            HTTP::redirect "https://[HTTP::host]/NEWS/"
        }
    }
    

    or

    when HTTP_REQUEST {
        if { [HTTP::path] equals "/" } {
            HTTP::redirect "/NEWS/"
        }
    }