Forum Discussion

Chris_Stamm_183's avatar
Icon for Nimbostratus rankNimbostratus
Nov 03, 2010

http class profile and trailing /

I have one VIP. DNS would resolve this VIP as such. =





To keep it simple let's say I have three http class profiles configured below.





Look for host name regex string (?i)


Look for URI regex string (?i)uri1


If both are matched then send to Pool1



Httpclass2 Look for host name regex string (?i)


Look for URI regex string (?i)uri2


If both are matched then send to Pool2





Look for host name regex string (?i)


If matched then send to Pool3



The idea is that if a person types (or other variations etc.) they are sent to Pool1. If they send they are sent to Pool2. The last http class (httpclass3) is a catch all for the domain I am matching host because eventually there will be more than one host so I would want to be able to match host and URI then make the decision.



So - the problem is that the user has to type a trailing slash or otherwise it will not catch the string. If the user just types or then it misses the catch with httpclass1 and httpclass2 so it sends to the catch all http class (httpclass3) and the desired effect is lost.



Am I doing something wrong in my URI match in the http class?



I have tried all of the following...


/uri1 (pattern string)


/uri1* (pattern string)


uri1 (pattern string)


uri1* (pattern string)


(?1)/uri1 (regex)


(?1)/uri1* (regex)


(?1)uri1* (regex)



and none seem to work it always requires the trailing /



6 Replies

  • Chris: for this particular task I'd actually suggest going the iRule route. Do a search on uri switching and you'll see a bunch of examples. I'd suggest using the switch -glob command for this as well. Have a look here for the general idea (look at the second example on URI switching):




  • Is it more efficient?



    After days of searching for answers I just barely came accross this post and created an http profile with matching enabled on the redirect rewrite and that fixed the problem.





    I am going to read up on the redirect rewrite and learn more about it to make sure it does not have any other adverse affects.
  • Hi Chris,



    Nice work. If rewrite redirects solves the issue, it would be a lot more efficient than coming up with complicated regexes for your HTTP class filters.



  • With that part working I have another related issue that surfaced. Because we redirect to a different pool on the backend based on the URI that particular URI is sent back unaltered to the backend server - for example...


  is sent to a backend pool member as



    If the base path of the webserver is / then I would need a directory in there called uri1 where i placed all the files (i.e. /uri1/default.html, /uri1/whatever.html)



    In the http class there is a rewrite URI option but I cannot find any documentation on stripping off the /uri1 so the path to the backend server would be (ideal) as opposed to (not ideal).



    Any ideas where I can find this documentation?



  • You can use standard TCL commands in the rewrite field:



    [string map {/uri1/ /} [HTTP::uri]]



    For more info see SOL7771:



    SOL7771: Rewriting URIs using the HTTP class profile