Forum Discussion
Help deleting header name that contains curly braces
- Nov 18, 2022
I think I just figured it out guys Mohamed_Ahmed_Kansoh CA_Valli
Paste this and run it. It worked out for me. Now any of you can explain why this works?? Is this a bug with F5? At least it seems to me. If it is, how can I let them know so they can fix it.
when HTTP_REQUEST { if { [HTTP::uri] eq "/demo2" } { HTTP::header insert "{esbsoapheader}userName" "spencer" foreach aHeader [HTTP::header names] { log local0. "HTTP Request Headers: $aHeader: [HTTP::header value $aHeader]" } log local0. "***************REMOVING BAD HEADER************" HTTP::header remove "\\{esbsoapheader\\}userName" foreach aHeader [HTTP::header names] { log local0. "HTTP Request Headers: $aHeader: [HTTP::header value $aHeader]" } } }
Hello, I'd love to help you out but this is turning out to be tricky.
It's not possible to edit header name directly via iRule, so my code retrieves {esbsoapheader}userName value and inputs it into a new userName header. Then I'm attempting to delete {esbsoapheader}userName -- but this fails. I see iRule execution crashes and cllient connection is reset.
I've tried escaping curly braces with "\" as well, or passing it via a variable, but it doesn't seem to work.
Will it be enough to just insert userName? Is it a problem if {esbsoapheader}userName exists in request?
Sharing my progress so far.
when HTTP_REQUEST {
if { [HTTP::header exists "{esbsoapheader}userName"] }{
HTTP::header insert userName [HTTP::header "{esbsoapheader}userName"]
# non-working code
# HTTP::header remove "{esbsoapheader}userName"
# HTTP::header remove "\{esbsoapheader\}userName"
# HTTP::header remove \{esbsoapheader\}userName
# set hnme "{esbsoapheader}userName" ; HTTP::header remove $hname
}
}
Thank you for taking the time to look into this CA_Valli
What you just showed to me is the fix that I gave the people that first asked me to remove {esbsoapheader} from header name.
I ended up just inserting a new header name just with userName and did not remove the bad header name. However, this is not quite what they were looking for so that is why I came to the F5 forum to look for answers.
I'm extremely curious how it worked out for Mohamed_Ahmed_Kansoh ...
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