Forum Discussion
The_Bhattman
Dec 04, 2009Nimbostratus
Looks good from what I can tell. The only thing I would suggest is to check for the existence of the header. This way you are not always inserting for returning connections that already have it.
when HTTP_REQUEST {
if {([TCP::local_port] ==80) and !( [HTTP::header "X-Forwarded-Proto"] eq "http") }{
HTTP::header insert X-Forwarded-Proto "http"
log local0. "HTTP request from Client IP: [IP::client_addr] to [IP::local_addr]:[TCP::local_port]"
} elseif {([TCP::local_port] ==443) and !( [HTTP::header "X-Forwarded-Proto"] eq "https") } {
HTTP::header insert X-Forwarded-Proto "https"
log local0. "HTTPS request from Client IP: [IP::client_addr] to [IP::local_addr]:[TCP::local_port]"
}
}
I hope this helps
Bhattman