Forum Discussion
rockthef5
Jun 18, 2019Nimbostratus
header substr
Hi Guys,
I have a header field coming from the http request.
X-Akamai-Edgescape: georegion=263,country_code=US,region_code=MA,city=CAMBRIDGE,dma=506,pmsa=1120,areacode=617,county=MIDDLESEX,fips=25017,lat=42.3933,long=-71.1333,timezone=EST,zip=02138-02142+02238-02239,continent=NA,throughput=vhigh,asnum=21399
at first i want to extract just country_code=US and save it in a var.
at second i want create a new header like x-test=$var
and finally i want to insert the new header to the original request and forward it to the back end system.
any ideas how i can achieve it?
Thanks 4 you help
Try this
when HTTP_REQUEST { if {[HTTP::header exists "X-Akamai-Edgescape"]} { set headerList [split [HTTP::header value "X-Akamai-Edgescape"] ,] set countryCode [lindex $headerList [lsearch -glob $headerList "country_code=*"]] HTTP::header insert "x-test" $countryCode } }
- Lee_SutcliffeNacreous
Try this
when HTTP_REQUEST { if {[HTTP::header exists "X-Akamai-Edgescape"]} { set headerList [split [HTTP::header value "X-Akamai-Edgescape"] ,] set countryCode [lindex $headerList [lsearch -glob $headerList "country_code=*"]] HTTP::header insert "x-test" $countryCode } }
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects