For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

CSA's avatar
CSA
Icon for Nimbostratus rankNimbostratus
Mar 23, 2010

Adding www. before HTTP::host / regexp matching

Hi,

 

 

We have today many websites like www.AA.domain.com where AA is a ccTLD (a country code). We want to have the websites working when users type AA.domain.com.

 

 

In the DNS, AA.domain.com is a CNAME to www.AA.domain.com.

 

 

I want to make the BigIP rewrite AA.domain.com to www.AA.domain.com

 

 

I did this but it doesn't work:

 

 

when HTTP_REQUEST {

 

if { [ string tolower [HTTP::host] ] matches_regex "(?:^\w\w\.domain\.com$)" } {

 

HTTP::redirect "http://www.[HTTP::host]/[HTTP::uri]"

 

}

 

}

 

 

Any idea why it doesn't work ? I don't find many doc about regexp in irules.

 

 

Many thanks,

11 Replies