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
}
}
CA_Valli Do you know why it is not possible to remove "{esbsoapheader}userName"? Is it because the header name is using characters that are not legal to use in a header name? If so, do you have some resource that I can read to confirm?
- Nov 18, 2022
it does not work with me ,
I meant the iRule script is correct and accepted , I thought you have a problem with that.
No I have performed your script on my test lab and I saw the TCL error:Let me see how can I remove it , if I found a workaround , definitely I will share it with you
Regards- Nov 18, 2022
Spencer_Aranda ,
you are right ,
the issue exactly with remove and {} , I replaced {} with // and it works well.
I think you must change the inserted header and not use {}.
I tried to put this header in variale , and delete this variable but without Luck.
what a strange thing !!
why irule executed well without errors , and couldn’t perform the task of delete.
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