Forum Discussion
Insert custom HTTP header determined by VS protocol
Dear all,
I have two VS sending the traffic to the same pool server. The idea was to be able to identify from the log server from which VS (HTTP or HTTPS) the traffic was coming from.
So I implemented this irule but it's not working.
Does anyone has an idea of what is wrong with ths irule ?
when CLIENT_ACCEPTED {
switch [TCP::local_port] {
"443" {
set proto "https"
}
"80" {
set proto "http"
}
}
}
when HTTP_REQUEST {
HTTP::header insert VS_HTTP_PROTO $PROTO
}
Thank you a lot for your help !!
2 Replies
- Kevin_Stewart
Employee
There are potentially two problems:
-
You've defined a local variable called "proto", but then accessing it as "PROTO". TCL is case sensitive.
-
I've found that many versions of IIS don't like headers with underscores in them. It will natively replace dashes with underscores, but doesn't seem to like it when the header names arrive with underscores.
Try this:
when CLIENT_ACCEPTED { switch [TCP::local_port] { "443" { set proto "https" } "80" { set proto "http" } } } when HTTP_REQUEST { HTTP::header insert VS-HTTP-PROTO $proto } -
- Janek_42109
Nimbostratus
Hello Kevin,
It works perfectly.
Thank you very much
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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