Forum Discussion
regex HTTP::header replace "Host"
I am trying to create an irule that can use a regex like:
/^([\s\S]?)(domain.com)./g
So if a user types:
domainname.com
abc.domainname.com
abc.domainname.com\xyz
It will still work.
Current irule
when HTTP_REQUEST {
if { [string tolower [HTTP::uri] ] contains "/?node=1" } {
HTTP::header replace "Host" "dev.domainname.com"
HTTP::path "/"
node 192.168.70.57 443
}
}
I have tried to put the irule in line but it keeps giving errors and google is no help at all.
when HTTP_REQUEST {
if { [string tolower [HTTP::uri] ] contains "/?node=1" } {
HTTP::header replace "Host" "/^([\s\S]*?)(domainname).*/g"
HTTP::path "/"
node 192.168.70.57 443
}
}
I do not see an edit button but the irule would look like.
when HTTP_REQUEST { if { [string tolower [HTTP::uri] ] contains "/?node=1" } { HTTP::header replace "Host" "/^([\s\S]*?)(domainname.com).*(node=1)/g" HTTP::path "/" node 192.168.70.57 443 } }
- Stanislas_Piro2Cumulonimbus
Anthony,
you created 2 threads about the same need.
in the previous thread, you wanted to balance based on a different hostname, which is the recommended solution. but at the end, you changed to load balancing based on a query string....
I recommend you to explain the expected application behavior and not ask for an irule.
After, we can help you to choose the best solution.
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