Forum Discussion
taking value and append to uri while masking?
I was able to find the first part on DevCentral forum of which it takes the value before the domain and adds as uri for testing purposes, however I get the following error when I try to save it.
01070151:3: Rule [/Common/ddc-wpchange1.com_irule] error: /Common/ddc-wpchange1.com_irule:8: error: [parse error: PARSE syntax 289 {syntax error in expression " [string tolower [HTTP::host]] ends with $::domain ": extra tokens at end of expression}][{ [string tolower [HTTP::host]] ends with $::domain }] /Common/ddc-wpchange1.com_irule:21: error: [wrong args][HTTP::host [string range $::domain 1 end]]
when RULE_INIT { Set the value for the domain with a leading period We'll check the host header value for any string the comes before this string and prepend it to the URI set ::domain ".test123.com" } when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends with $::domain }{
Get any part of the host that comes before the domain.
Split the URI using the domain string. Grab the first string that comes before the domain
set subdomain [getfield [HTTP::host] $::domain 1]
If subdomain isn't null, prepend it to the URI
You could also add additional checks here like subdomain doesn't equal "www"
if { not ($subdomain == "") }{
HTTP::uri [concat "/$subdomain[HTTP::uri]"]
Set the HTTP host to the domain
HTTP::host [string range $::domain 1 end]
}
} }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com