Forum Discussion
raytoles_75680
Nimbostratus
Dec 03, 2009Header Insert of "http" or "https"
We're going to implement a virtual server to handle HTTP and HTTPS requests. The developers need us to insert the protocol into the header. We're still new to irules and I constantly fear performanc...
The_Bhattman
Nimbostratus
Dec 04, 2009Looks 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
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