Forum Discussion
- Danny_Trinh_197NimbostratusThe simplest way is you create an alias in your dns system to point domain.com to www.domain.com.
- Mike_WethingtonNimbostratusThat is already in place, and works. What i need to do is when the request hits my BIG-IP i need to tack on the www. to the domain.com but only if it comes in as http://domain.com.
- hooleylistCirrostratusOr you can use an iRule:
when HTTP_REQUEST { Check if there was a host header value doesn't start with www. and does start with an alphabet character if { not ([string match -nocase www.* [HTTP::host]]) && [string match -nocase a-z* [HTTP::host]]}{ HTTP::redirect "http://www.[HTTP::host]" } }
when HTTP_REQUEST { Check if the host header value isn't www.domain.com if { not ([string tolower [HTTP::host]] eq "www.domain.com") }{ HTTP::redirect "http://www.domain.com" } }
- Mike_WethingtonNimbostratusThanks Aaron, this worked you are the man.
- Fotios_30046NimbostratusIf they came into a specific url without the www prefix, would you just add the [HTTP::uri]?
- hooleylistCirrostratusIf you rewrite the URI, the client wouldn't necessarily see the update to www.example.com and may end up making a request to https://example.com instead of https://www.example.com causing a cert mismatch error on the browser.
- Fotios_30046NimbostratusGood point, I didn't think of that Aaron.
- JRahmAdminAn alternative to the string match, though I'm not sure which is more optimal:
when HTTP_REQUEST { if { [HTTP::host] equals [domain [HTTP::host] 2] } { HTTP::redirect "http://www.[HTTP::host]" } }