Forum Discussion
kykong_107132
Nimbostratus
Apr 20, 2009HTTP responser header insert base on URI
Hi all,
how can we insert HTTP RESPONSE header base on URI? Example, if HTTP request URI contains "/test/header/", I need to insert a new header "Via test_server" in the HTTP RESPONSE header. ...
hoolio
Cirrostratus
Apr 20, 2009Hi kky,
Sure, here is an example:
when HTTP_REQUEST {
Check if some condition in the request is true
if {[HTTP::path] starts_with "/test/string"}{
Track that we want to insert a header in the response
set insert_response_header 1
} else {
Track that we do not want to insert a header in the response
set insert_response_header 0
}
}
when HTTP_RESPONSE {
Check if we're inserting a header in the response
if {$insert_response_header}{
Insert the header
HTTP::header insert "my_header_name" "my_header_value"
}
}
Aaron
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