Forum Discussion
Wes_98712
Nov 08, 2011Nimbostratus
Header Inserts
I am experiencing a somewhat odd situation. I created an HTTP profile and setup a name value pair in the Request Header Insert (SSL_ENV:On). When I debug in Fiddler to see if the header is inserted, I don't see anything which is really strange. So I went the iRule route and tried to test if the header was set and if it wasn't set it to On:
when HTTP_REQUEST {
set myhost [HTTP::host]
set myuri [HTTP::uri]
if { ![HTTP::header "SSL_ENV"] equals "On" } {
HTTP::header insert SSL_ENV On
log local0. "HEADER HTTPVS: [HTTP::header "SSL_ENV"]"
} else {
if { $myuri starts_with "/API" } {
log local0. "URL: $myuri going to non_ssl pool"
pool pool_one_80
} else {
HTTP::redirect "https://$myhost$myuri"
}
}
}
It throws a strange error on the ![HTTP::header
[undefined procedure: !HTTP::header] [!HTTP::header "SSL_ON"]
I thought inserting a header would be really straight forward and easy, but somehow I am missing something. Thoughts?
BTW: I created the same rule in SSL and HTTP to check if the header didn't exist and then create it. Still no dice.
- Michael_YatesNimbostratusHi Wes,
FROM: if { ![HTTP::header "SSL_ENV"] equals "On" } { TO: if { !([HTTP::header "SSL_ENV"] equals "On") } {
- When I debug in Fiddler to see if the header is inserted, I don't see anything which is really strange.
- Wes_98712NimbostratusThat makes total sense then regarding the HEADER debugging, and the code change above. The strange thing is the variable doesn't seem to remain static once set. I wonder if I have to do both on the HTTP_RESPONSE as well as REQUEST.
- The strange thing is the variable doesn't seem to remain static once set.
- Wes_98712NimbostratusMake sense, yes the header is telling the backend servers to maintain a secure session, we recently moved to F5 from a different vendor and it would appear that the header variable (ASP server variable) may be displayed differently. The team is checking using something like the following:
if Request.ServerVariables("SSL_ENV")="On" then
- It appears F5 is appending the variable with a :,
- nitassEmployeeRegarding your ASP code. I believe the correct way to access the HTTP request header is HTTP_, in your case HTTP_SSL_ENV, instead of SSL_ENV.i agree with Kurt.
- we recently moved to F5 from a different vendor
- Wes_98712NimbostratusKurt/Nitass,
- nitassEmployeeOne last question regarding HTTP_REQUEST vs HTTP_REQUEST_SEND, implementing the insert should be within the initial REQUEST correct? No reason to switch to the REQUEST_SEND correct?since you do not need any information from server-side, inserting it in client-side event i.e HTTP_REQUEST is fine.
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