Forum Discussion
Alex_Suslik_102
Nimbostratus
Sep 19, 2006check client SSL encryption level support
Client targeting https://strong.test.com
This code should redirect to a pool "client_info" only if the browser does not support 128 or 256 bit encryption, but it always redirects to this poo...
Hi Rogerio,
Something like this?
when HTTP_RESPONSE {
Check if the Content-Type header value matches our criteria
if {[HTTP::header value Content-Type] contains "somestring"}{
log local0. "[IP::client_addr]:[TCP::client_port]: Matched the Content-Type check for [HTTP::header value Content-Type]"
Initialize a variable to save the cookies
set cookie_string ""
Loop through each Set-Cookie header. Save the value to a string, and remove the header.
while {[HTTP::header exists Set-Cookie]}{
Append the current Set-Cookie value to the cookie string
append cookie_string [HTTP::header value Set-Cookie]\;
log local0. "[IP::client_addr]:[TCP::client_port]: Current \$cookie_string: $cookie_string"
Delete the current Set-Cookie header
HTTP::header remove Set-Cookie
}
Include the cookies in the 302 response if there were any
if {[string length $cookie_string]}{
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting with cookies to: http://example.com Set-Cookie $cookie_string"
Send the 302 redirect response with the cookies
HTTP::respond 302 Location "http://example.com" Set-Cookie $cookie_string
} else {
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting without cookies to: http://example.com"
Send the 302 redirect response without the Set-Cookie header as there weren't any cookies
HTTP::respond 302 Location "http://example.com"
}
}
}
I didn't test it, but it passed an iRuler syntax check. If you run into problems with it, check the /var/log/ltm log file for debug output. Make sure to comment out or remove the logging before using the iRule in production.
Aaron