Introduction
This document provides a sample configuration to insert www in the URL of incoming client request. ACE will insert www in the incoming client connection in case this is missing in the request. This works well with http requests only; https requests will get certificate error. ACE uses traffic classification maps (class maps) within policy maps to filter out interesting traffic and to apply specific actions to that traffic. ACE uses policy maps to combine class maps and parameter maps into traffic policies and to perform certain configured actions on the traffic that matches the specified criteria in the policies.
Prerequisites
Users should be fairly familiar with ACE and loadbalancing concepts.
Requirements
There are no specific requirements for this document.
Configure
To insert www in the URL of client request you need to configure redirection. The redirection will redirect the user request to appropriate URL. For example if the user requested URL is http://mydomain.com, then it will be redirected to http://www.mydomain.com. Follow the steps to configure this.
a) First configure redirection, which matches and redirects to URL with www in it.
rserver redirect with_www
webhost-redirection http://www.%h%p 301
inservice
b) Now apply this action on the serverfarm.
serverfarm redirect REDIRECT
rserver with_www
inservice
Note that using this method you can redirect https requests as well, but users will get certificate error because of the change in the URL. The workaround for this is to install a wildcard certificate which will match both of the URLs.
rserver redirect http
webhost-redirection https://%h%p 301
inservice
rserver redirect http_and_www
webhost-redirection https://www.%h%p 301
inservice
serverfarm redirect REDIRECT
rserver http
inservice
serverfarm redirect REDIRECT_and_www
rserver http_and_www
inservice
class-map type http loadbalance match-all http_with_www
2 match http header Host header-value www.*
policy-map type loadbalance first-match LB_REDIRECT
description L7SLBPolicy-Redirect
class http_with_www
serverfarm REDIRECT
class class-default
serverfarm REDIRECT_AND_WWW
Related Information
ACE behavior with static sticky and rserver down situation
SSL URL Rewrite with wildcard on ACE