cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2848
Views
0
Helpful
3
Replies

Layer 7 class-map with different match types

yves.haemmerli
Level 1
Level 1

Hello,

I am fighting with a problem on an ACE-4710 version A3(2.4) configuation. I just want to configure a layer 7 class-map that matches if one of two conditions is true. The problem is that these conditions are not from the same type and the ACE refuses the second match statement. However, in the configuration guide, it is clearly defined that it should be possible :

Here is what the configuration guides says :

host1/Admin(config)# class-map type http loadbalance match-any CLASS3
host1/Admin(config-cmap-http-lb)# 100 match http url .*.gif
host1/Admin(config-cmap-http-lb)# 200 match http header Host header-value XYZ
host1/Admin(config-cmap-http-lb)# exit

If I test exactly the same configuration in a context of my ACE, I receive an error message :

CH01AC03/P-104-A(config)# class-map type http loadbalance match-any CLASS3
CH01AC03/P-104-A(config-cmap-http-lb)# 100 match http url .*.gif
CH01AC03/P-104-A(config-cmap-http-lb)# 200 match http header Host header-value XYZ
Error: Match-any classmap can not have different type of match

If I use nested class-maps, I receive the same error message !

Is it a known problem or is it a solution for it ?

Thank you for any help

Yves

3 Replies 3

Sean Merrow
Level 4
Level 4

Hello Yves,

The command error is correct.  I'll take a look at the docs and see about getting them corrected, if necessary.

Basically, for a match-all, you would have to use different types.  For example, there will only be one Host header, so you would only specify it once using regex or a fixed string.  As you found out, the match-any requires that they all be of the same type.  See my example below:

class-map type http loadbalance match-all HEADER-AND-URL
  100 match http url /login.*
  200 match http header Host header-value "XYZ"

class-map type http loadbalance match-any URLS
  100 match http url .*\.gif
  200 match http url .*\.jpg

class-map type http loadbalance match-any HEADER
  200 match http header Host header-value "CISCO"

policy-map type loadbalance first-match SLB_LOGIC
  class HEADER-AND-URL
    serverfarm LOGIN-FARM
  class URLS
    serverfarm IMAGES-FARM
  class HEADER
    serverfarm CISCO-FARM
  class class-default
    serverfarm WWW-FARM

So let's say you want to match requests for URLs ending in .jpg or for requests with Host header XYZ, and if it matches either one, then send to the same serverfarm.

class-map type http loadbalance match-any URL-JPG
  2 match http url .*\.jpg

class-map type http loadbalance match-any HOST-XYZ
  2 match http header Host header-value "XYZ"

policy-map type loadbalance first-match SLB_LOGIC
  class URL-JPG
    serverfarm SERVER-FARM
  class HOST-XYZ
    serverfarm SERVER-FARM

If you wanted to send these requests to the farm only if they matched BOTH matches, then you could do it as follows:

class-map type http  loadbalance match-all HEADER-AND-URL
   100 match http url /login.*
   200 match http header Host header-value "XYZ"


policy-map type  loadbalance first-match SLB_LOGIC

   class HEADER-AND-URL
     serverfarm LOGIN-FARM

Hope this helps,

Sean

Sean Merrow
Level 4
Level 4

Hello Yves,

Here is the desciption in the docs explaining the match-all and match-any.  It looks good to me.  Can you point me to the spot in the docs where you got that example from so that I can see about getting it fixed?

Thanks,

Sean

Hi Sean,

Thank you so much for your precise answer. You can find the configuration example I mentionned in the ACE Load Balancing Configuration Guide on page 3-49. Thank you for a quick feedback.In the meantime, I managed to make it working with the policy map method.

Best regards,

Yves

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: