03-06-2014 04:59 AM
Hello.
I was asked to implement some rules and one of them is overlaping the other I think becasue is shorter and it´s using the regular expression .*
Regarding the configuration below I always get redirected to http://SITE1 instead of http://SITE2 when I type www.AAA/fr/pages/AAA/index.php because the class REDIRECT_NM_LORO_PMUR_CLASS always win even it´s in the bottom of the policy-map.
Is there some way to order the classes in a policy-map to act as an access-list does? (from the top to the bottom and stop looking up when a match is found), In other words, make the class REDIRECT_PMUR_RAPPORTS_CLASS is done before REDIRECT_NM_LORO_PMUR_CLASS
which is more generic.
Config example:
rserver redirect REDIRECT_PMUR
webhost-redirection http://SITE1 301
inservice
rserver redirect REDIRECT_PMUR_RAPPORTS
webhost-redirection http://SITE2 301
inservice
rserver redirect REDIRECT_PMUR_RESULTATS
webhost-redirection http://SITE3 301
inservice
serverfarm redirect REDIRECT_NM_LORO_PMUR_FARM
rserver REDIRECT_PMUR
inservice
serverfarm redirect REDIRECT_PMUR_RAPPORTS_FARM
rserver REDIRECT_PMUR_RAPPORTS
inservice
serverfarm redirect REDIRECT_PMUR_RESULTATS_FARM
rserver REDIRECT_PMUR_RESULTATS
inservice
class-map type http loadbalance match-any REDIRECT_NM_LORO_PMUR_CLASS
4 match http url /fr/pages.*
class-map type http loadbalance match-any REDIRECT_PMUR_RAPPORTS_CLASS
3 match http url www.AAA/fr/pages/AAA/index.php
class-map type http loadbalance match-any REDIRECT_PMUR_RESULTATS_CLASS
3 match http url www.BBB/fr/pages/BBB/index.php
policy-map type loadbalance first-match POLICY_REDIRECT_NM_LORO_CAT2_FARM
class REDIRECT_PMUR_RESULTATS_CLASS
serverfarm REDIRECT_PMUR_RESULTATS_FARM
class REDIRECT_PMUR_RAPPORTS_CLASS
serverfarm REDIRECT_PMUR_RAPPORTS_FARM
class REDIRECT_NM_LORO_PMUR_CLASS
serverfarm REDIRECT_NM_LORO_PMUR_FARM
class class-default
serverfarm NM_LoRo_CAT2_FARM
Thank you very much,
Miquel
03-06-2014 05:22 PM
Hi Miquel,
This is what it seems is happening. Your class-map condition is based on URL and not host-header value so ACE is not even considering www.AAA or www.BBB. It is only looking for fr/pages/xxxxxxxx which only matches 3rd class map and that's why you get the match and hence the corresponding redirection.
Can you try using class map condition based on Host ?
switch/Admin(config-cmap-http-lb)# 2 match http header Host header-value ?
Please try and let me know how it goes.
You can also test my removing that /fr/pages/.* condition and see if it matches or not as well.
Regards,
Kanwal
03-06-2014 05:26 PM
Hi Miquel,
Also, When matching data strings, note that the period (.) and question mark (?) characters do not have a literal meaning in regular expressions. Use brackets ([ ]) to match these symbols (for example, enter www[.]xyz[.]com instead of www.xyz.com). You can also use a backslash (\) to escape a dot (.) or a question mark (?). Try this as well in your class-map condition and see if it makes a difference.
Regards,
Kanwal
03-07-2014 03:26 AM
Hi Fnu.
I can´t use the header because I need to match a specific piece of url, for example, using the url
www.hello.com/folder/subfolder/index.php, the request is:
-All that explicitely contains whatever hello.com/folder/subfolder whatever have to go to site 1
-Anything starting with whatever hello.com have to go to site 2
So I think the ideal sollution for matching woud be to use the URL BUT having the ability to choose what class will be the first to trigger in the policy-map as an access-list does.
Thank you!
Miquel
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide