Forum Discussion
Gilev_Anton_260
Nimbostratus
Aug 17, 2017Adding/rewriting header in server response.
Hello. Pretty new to F5 and whole iRules and already hit a wall. We need to do a next thing:
If a user's request contains a certain header, i need to return content of that header in another header i...
Jad_Tabbara__J1
Cirrostratus
Aug 17, 2017Hello Gilev,
Your code contains error, try the following :
Also from ssh check the log file in real time using command
tail -f /var/log/ltm
when HTTP_REQUEST {
if { [HTTP::header exists "Header"] } {
set insert_response_header 1
set header_var [HTTP::header value "Header"]
log local0. "Header value in request $header_var"
pool pool_POOL_HLS
} else {
pool pool_POOL_HLS
}
}
when HTTP_RESPONSE {
if { $insert_response_header eq "1" } {
HTTP::header replace "CORS" $header_var
log local0. "Header CORS value [HTTP::header value "CORS"]"
}
}
Hope it helps
Don't forget to give us feedback
Regards
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