Forum Discussion

Pat_Gorsuch_109's avatar
Pat_Gorsuch_109
Icon for Nimbostratus rankNimbostratus
Oct 20, 2005

HTTPS redirect on URI

Not huge into writing rules, but I had hoped I would be able to hack my way through a simple task. Obviously that notion has fallen on its butt.

 

 

I need to redirect requests containing a specific string within the URI to only one server; everything else can use any host in the pool. I think I have the syntax correct, though I can't seem to get the hang of when to use a Server Profile (if at all?) and which one will get things moving.

 

 

Specifics:

 

 

https://www.conhugeco.com/admin -> node 10.151.54.141

 

https://www.conhugeco.com/ -> conhugeco_web_pool

 

 

iRule:

 

 

when HTTP_REQUEST {

 

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

 

node 10.151.64.141

 

} else {

 

pool conhugeco_web_pool

 

}

 

}

 

 

I've set the Server Profile to HTTP (the VS is listening only on TCP/443). Nothing good happens. Actually, nothing happens. Even if I disable the iRule and leave everything else alone, there's no F5 love.

 

 

I realize that this may not have anything to do with the actual iRule, but I'm unsure how the Server Profile selection (and maybe other settings) effect the use of an iRule.

 

 

Any advice for a humble novice?

 

 

- Pat
  • Try a log statement before the if statement to see if you are getting the URI you are expecting

     

     

    log "URI is [HTTP::uri]"

     

     

    I'd also use:

     

     

    use pool conhugeco_web_pool member 10.151.64.141

     

     

    instead of:

     

     

    node 10.151.64.141
  • Thanks for the quick response.

     

     

    I've added the "log" line, but don't get anything posted to the log. This leads me back to the notion that I've hosed something with the VS setup and thus I'm not even getting to execute the iRule.

     

     

    I realize this is probably a bit out of scope for the regular discussions here, but appreciate any assistance. (And yes, I do have a case opened with TAC.)

     

     

    - P
  • is this a production unit? If not, make sure your iRule is associated to the virtual and try a bigstart restart tmm
  • Nothing like a kick in the butt to get me moving. Yes, I wasn't specifying my VS profiles properly. All happy now.

     

     

    Thanks for the hand-holding.

     

     

    - P
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Awesome to hear. I'm glad that things are working now.

     

     

    Be sure to stop in again if you've got any more questions or problems to work through.

     

     

    -Colin