Forum Discussion

Arie's avatar
Arie
Icon for Altostratus rankAltostratus
Apr 30, 2008

HELP! - what's wrong with this redirect?

when HTTP_REQUEST {

 

 

 

if { [string tolower [HTTP::uri]] starts_with "/account" } {

 

 

HTTP::redirect https://www.domain2.com[HTTP::uri]

 

 

}

 

 

 

}

7 Replies

  • Nothing? Are you seeing an error on the browser? Are you seeing a TCL error in /var/log/ltm? What are the symptoms of the issue?

     

     

    Aaron
  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    Error on the browser: The connection to the server was reset while the page was loading

     

     

    It's the first iRule that's loading. Unfortunately, I don't have access to the log files.

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    Strangely enough, this one is working:

     

     

    when HTTP_REQUEST {

     

     

     

    if { [string tolower [HTTP::uri]] starts_with "/foyc" } {

     

     

    HTTP::redirect http://www.domain2.com[HTTP::uri]

     

     

    }

     

     

     

    }
  • I would guess there is a conflict between this rule and another iRule or module on the BIG-IP. Can you view the ltm log through the GUI under System >> Logs >> Local Traffic? Else, can you get a copy of the bigip.conf and post an anonymized copy of the virtual server and rule(s) definitions?

     

     

    Aaron
  • A couple of things. First, your first iRule is redirecting to https://www.domain2.com/account*. Have you tested that this URI works on it's own outside of the iRule. Also, I'm assuming that this iRule is NOT on the https virtual for www.domain2.com, otherwise you'll get yourself into a infinite loop.

     

     

    As for your second iRule working, that one is redirecting to "http://www.domain2.com/...", which is NOT the https VS that the first iRule is redirecting to. Was this intentional?

     

     

    I would try the redirected URIs manually and see if they work. It could be that the server error is coming from the www.domain2.com server after the browser has been redirected.

     

     

    As hoolio said, if you could pass along the setup of which virtuals are what and which ones have the iRules on them, it will take some of the guessing out on our part.

     

     

    -Joe
  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    Scenario:

     

     

    Domain www.domain.org is being phased out and replaced with www2.domain.com. However, at this time only certain pages/sections of this site are to be redirected.

     

     

    Need to forward all requests to www.domain.org/account/* to www2.domain.com/account/.

     

     

    Couple of VS in play here:

     

     

    - vs_www.domain.org_80

     

    - vs_www2.domain.com_443

     

     

    There's a pool vs_www.domain.org_443 also, but for now I'm starting with getting the simples version to work.

     

     

    iRules on vs_www.domain.org_80:

     

     

    - redirect_account (name of the iRule that's not working)

     

    - more redirects and other iRules, but since redirect_account is the first one I assume that the others won't be invoked if there's a match for www.domain.org/account/. (BTW, I am correct in this assumption, I hope?)

     

     

    iRules on vs_www2.domain.com_443:

     

     

    - select pool based on URI, since some parts of the sites are running on .NET and others on ColdFusion and not all servers are running ColdFusion.

     

     

    URI's all work great if entered manually. (https://www2.domain.com/account/subfolder/)

     

     

    I'm still digging for related errors in the log.
  • Hi

     

    The answer to this is very easy. There was a change in the parser. Therefore If there is a sentense with // in it you need to have "" arround it...

     

     

    HTTP::redirect "https://www.domain.com[HTTP::uri]"