One common problem with SSL offload is that applications create redirects based on the protocol they received the request as, and creates an absolute redirect with the protocol specified. In addition, the location header will probably be absolute in such a case, which results in a slight inefficiency as a new connection will be created by the browser even if the redirect host matches the current host. The following example configuration will use the patclas function to match a set of domains that are equivalent, and rewrite the response header as a relative redirect instead of absolute redirect IF the header matches.
add policy patClass domains
bind policy patClass domains
domain.com - Get online with a domain name and web hostingbind policy patClass domains alias.domain.com
add rewrite action Location_abs_rel replace "http.RES.HEADER(\"Location\")" "http.RES.HEADER(\"Location\").TYPECAST_HTTP_URL_T.PATH"
add rewrite policy abs_rel_domain_redir "http.RES.header(\"Location\").CONTAINS_ANY(\"domains\")" Location_abs_rel
bind rewrite global abs_rel_domain_redir 20 NEXT -type RES_DEFAULT
Note: Be warned that as of the 8.x releases, the patclass provides a pure string match, so if the location header is "
www.domain.com" and the patclass includes "domain.com", the action will be executed, as the location header includes the string "domain.com".