Forum Discussion

T_Rajneesh's avatar
T_Rajneesh
Icon for Nimbostratus rankNimbostratus
Apr 26, 2019

Url redirection

Hi,

 

i'm trying to redirect to https://abc.com/Test/app. I have a written irule and applied to https vs but it is getting redirected to https://abc.com but not the desired url : https://abc.com/Test/app.

 

is something i missed or done wrong in irule . or Url starts with captial 'T' does it make any difference while executing irule

 

irule used:

 

when HTTP_REQUEST {

 

set host [string tolower [HTTP::host]] set uri [string tolower [HTTP::uri]]

 

if { $host == "abc" && $uri == "/" } { HTTP::redirect "; }

 

1 Reply

  • Hi,

    can you try this:

    when HTTP_REQUEST {
    
    set host [string tolower [HTTP::host]]
    set uri [string tolower [HTTP::uri]]
    
    log local0. "host: $host - uri: $uri"
    if { $host == "abc" && $uri == "/" } {
        log local0. "Matchhhh"
        HTTP::respond 302 Location "https://abc.com/Test/app"
    }
    

    I set you a log in order to check that you match the right condition...

    regards