Forum Discussion

Gill_32697's avatar
Gill_32697
Icon for Nimbostratus rankNimbostratus
May 03, 2013

Help simple irule

Hello, need best way to contruct a simple irule but that will allow me to add uri paths as the become active, what i have now is...

 

Im already doing a basic https redirect

 

HTTPS VIP is 10.10.10.100 with pool Pod5Pool

 

So external users will come in from https://mypods.icomp.com/pod5 and be natted to the VIP and past the the pool member with the /pod5 intact.

 

Internal useres will hit the VIP with they may or may not type /pod5 but I need them to end up at the same pool member with /pod5 whether they typed it or not.

 

But I will be adding more pods, like pod6, pod7 all going to the same pool member just with a uri path

 

 

Thank you.

 

 

 

 

 

 

3 Replies

  • Well, the easiest thing to do would be to just redirect the user (any user) to /pod5 if they didn't include it.

    
    when HTTP_REQUEST {
         if { not ( [string tolower [HTTP::uri]] starts_with "/pod5" ) } {
              HTTP::redirect "https://[HTTP::host]/pod5[HTTP::uri]"
         }
    }
    

    That would work for /pod5, but not sure how you'd know which pod to send a user to in the absence of some trigger value.
  • Got you, let me rephrase.. In the absence of a trigger, id sent them to a default home page, something like www.myhomepage.com So in your example I would need to add pod ? would I just copy and add a new line with pod6, pod7 . The user will add the pod via a link or shortcut, i just need to pass the pod to the pool memeber otherwise if no pod number then default-page.com

     

    I will always send request to pool Pod5pool, I just want to pass the uri /pod to the pool memeber, if no /pad then default page.

     

    So logically is would flow like this.

     

     

    if url contains /pod5

     

    Pod5pool member

     

    if url contains /pod6

     

    Pod5pool member

     

    if url contains /pod7

     

    Pod5pool member

     

    othwerwise

     

    default page
  • So something like this?

    
    when HTTP_REQUEST {
         if { not ( [string tolower [HTTP::uri]] starts_with "/pod" ) } {
              HTTP::uri "/default.html"
         }
    }
    

    Assuming you've assigned the Pod5pool to the virtual server, this would (transparently) send any request URI that didn't start with "/pod" to default.html. In this case you also wouldn't have to edit the iRule when adding new pods.