Forum Discussion
MihirP1208_3846
Nimbostratus
Feb 25, 2019I was able to get it to work using the following syntax:
when HTTP_REQUEST { Check for a non-null length host header if {[string match {[a-zA-Z]} [HTTP::host]]}{
Use string commands to parse the subdomain
set subdomain [string range [HTTP::host] 0 [expr {[string first . [HTTP::host]] -1}]]
Use the getfield command to parse the subdomain
set subdomain [getfield [HTTP::host] . 1]
Use scan to parse the subdomain
scan [HTTP::host] {%[^.]} subdomain
HTTP::header replace Host "www.test123.com"
HTTP::uri /$subdomain[HTTP::uri]
} }