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.
- Wes_98712NimbostratusKurt, we switched from Barracuda. Here's an update.
for each x in Request.ServerVariables response.write(x & "*" & Request.ServerVariables(x) & "* ") next
- Wes_98712NimbostratusMore on this, it seems as though the Request.ServerVariables isn't pulling the value of the SSL_ENV header. The RAW output shows it, but not the actual Request.ServerVariables(x). I don't believe this is an F5 issue, I did validate that I set the header insert correctly in the profile (SSL_ENV: On). Stumped!
- Wes_98712NimbostratusAnother update, after a lot of testing we discovered something odd about the way F5 is inserting the header value
if Request.ServerVariables("HTTP_SSL_ENV")="On" then response.write("WES Pass: " & Request.ServerVariables("HTTP_SSL_ENV") & " ") else response.write("WES Fail: " & Request.ServerVariables("HTTP_SSL_ENV:") & " ") end if
when HTTP_REQUEST { if { [HTTP::header "HTTP_SSL_ENV"] equals "On" } { log local0. "HEADER HTTPS is: [HTTP::header "HTTP_SSL_ENV"]" } }
- Wes_98712NimbostratusAnd another interesting development. If the variable has an _ in it, for whatever reason ASP doesn't detect the value. The F5 inserts it in the header as best as I can tell, but the ASP Request.ServerVariable doesn't pick up the value. This is really odd. I don't know if this is a bug with the way F5 inserts headers or if it's an ASP issue.
- nitassEmployeei am not familiar with asp. anyway, would you mind trying this asp code?
- Wes_98712NimbostratusIf I set it as a String and dump the output it works, which tells me what, it appears to be an encoding issue and not F5. Curious as to why it worked before with a different appliance. But whatever. ;-)
when HTTP_REQUEST { if { [HTTP::header "HTTP_SSL_ENV"] equals "On" } { log local0. "HEADER HTTPS is: [HTTP::header "HTTP_SSL_ENV"]" } }
- Wes_98712NimbostratusKurt,
- Michael_YatesNimbostratusHi Wes,
- HOWTO: Retrieve Request Headers using ISAPI, ASP, and ASP.Net
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