Forum Discussion
GavinW_29074
Feb 07, 2012Nimbostratus
HTTP_RESPONSE not firing
Hi there,
I'm using the ProxyPass v10 iRule to perform some path rewriting on some of our VIP's...
However we seem to be getting some sporadic issues whereby the HTTP_RESPONSE event isn't being triggered when the request is being processed.
This results in the site breaking as all the resource paths etc aren't being re-written by the ProxyPass irule...
An example debug log is:
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/HandleErrors : Processing HTTP_REQUEST at Priority 20...
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/HandleErrors : $maintenance_mode = 0, $ssl_error = 0, $failure_result = ''
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/CacheControl : CacheControl HTTP Request at Priority 50:
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/CacheControl : HTTP Request for Host: 192.168.151.15 URI: /home.faces
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/CacheControl : GET Method, enabling Cache
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/HandleErrors : Processing HTTP_REQUEST at Priority 750...
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/HandleErrors : $pool_error = 0
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/HandleErrors : Passed error checking... Continuing...
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : Processing ProxyPass HTTP_REQUEST
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : Not In Maintenance mode. Continuing...
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : Virtual Name = /Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, $vname = portal.comportal3.test.card.co.uk, $cname = portal, $clname = ProxyPass_portal
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: HTTP connection
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: Data Group ProxyPass_portal found.
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: $ppass = '/ /CommercialPortal'
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: ProxyPass_ value = / /CommercialPortal
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : Clientside: Path starts / Host Clientside=192.168.151.15, Path Clientside=/.
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : Serverside: Host Serverside=192.168.151.15, Path Serverside=/CommercialPortal.
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : Appending / to Path Serverside.
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: Found Rule, Original Path=/home.faces, Client Host=192.168.151.15, Client Path=/, Server Host=192.168.151.15, Server Path=/CommercialPortal/
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: Using default pool /Common/comportal3.test.app/comportal3.test_pool
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: $bypass value = 0
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: Continuing with rest of HTTP_REQUEST block.
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/CacheControl : Cache_Request for Host: 192.168.151.15 URI: /home.faces
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: Processing HTTP_REQUEST_SEND block.
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: New Host=192.168.151.15, New Path=/CommercialPortal/home.faces
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/ProxyPass : VS=/Common/comportal3.test.app/portal.comportal3.test.card.co.uk_http, Host=192.168.151.15, URI=/home.faces: Inserting header: X-Forwarded-For: 192.168.100.208
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/HandleErrors : Processing HTTP_REQUEST at Priority 20...
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/HandleErrors : $maintenance_mode = 0, $ssl_error = 0, $failure_result = ''
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/CacheControl : CacheControl HTTP Request at Priority 50:
Feb 7 17:03:53 tmm info tmm[9144]: Rule /Common/CacheControl : HTTP Request for Host: 192.168.151.15 URI: /CommercialPortal/javax.faces.resource/style.css.faces;jsessionid=8c584e5692cb13a77d7628839ebb?ln=commercial/css
AS you can see it's quite happily processing upto the HTTP_REQUEST_SEND block, but just receives no HTTP_RESPONSE.
However the browser appears to receive a response and moves onto requesting some of the non-rewritten resources. E.g. on the last line where it still contains 'CommercialPortal'...
Relevant config:
gavinw@actint-star-f501(Active)(/Common)(tmos) list /ltm virtual comportal3.test.app/portal.comportal3.test.card.co.uk_http
ltm virtual comportal3.test.app/portal.comportal3.test.card.co.uk_http {
app-service /Common/comportal3.test.app/comportal3.test
destination 192.168.151.15:http
ip-protocol tcp
mask 255.255.255.255
pool comportal3.test.app/comportal3.test_pool
profiles {
Caching_CommPortal { }
HTTP_Rewrite { }
oneconnect { }
stream { }
tcp-wan-optimized { }
wan-optimized-compression { }
}
rules {
ProxyPass
SplunkHTTP
CacheControl
CatchErrors
HeaderStripping
MaintenancePage
UnavailablePage
HandleErrors
}
snat automap
vlans-disabled
}
gavinw@actint-star-f501(Active)(/Common)(tmos) list /ltm profile web-acceleration Caching_CommPortal
ltm profile web-acceleration Caching_CommPortal {
app-service none
cache-uri-exclude { /home.faces }
cache-uri-include { .* }
cache-uri-include-override none
cache-uri-pinned { /javax.faces.resource/* }
defaults-from optimized-caching
}
gavinw@actint-star-f501(Active)(/Common)(tmos) list /ltm profile http HTTP_Rewrite
ltm profile http HTTP_Rewrite {
app-service none
defaults-from http
redirect-rewrite matching
}
gavinw@actint-star-f501(Active)(/Common)(tmos) list /ltm profile one-connect oneconnect
ltm profile one-connect oneconnect {
idle-timeout-override disabled
max-age 86400
max-reuse 1000
max-size 10000
source-mask any
}
gavinw@actint-star-f501(Active)(/Common)(tmos) list /ltm profile stream stream
ltm profile stream stream {
source none
target none
}
Any ideas what might cause this???
Cheers
Gavin
- GavinW_29074NimbostratusI've done some further testing and I'm still getting the occasional issue...
- spark_86682Historic F5 AccountThe only thing that jumps out at me is that you're using caching. If a cached document is served, HTTP_RESPONSE won't fire, but CACHE_RESPONSE will. Try adding a log statement to CACHE_RESPONSE and see if that lines up with the times that HTTP_RESPONSE isn't firing.
- GavinW_29074NimbostratusSpark
- hooleylistCirrostratusHi Gavin,
- GavinW_29074NimbostratusAaron
- GavinW_29074NimbostratusAs a further update, I've logged this issue with F5 support... yet to receive a response...
- GavinW_29074NimbostratusAh hah... Found it...
when RULE_INIT { set static::ErrorDebug 1 } when HTTP_REQUEST priority 50 { if {$static::ErrorDebug == 1} { log local0. "CatchErrors HTTP Request at Priority 50:" } Record request details encase needed later. set HTTP_HOST [HTTP::host] set HTTP_URI [HTTP::uri] set HTTP_METHOD [HTTP::method] set VSPool [LB::server pool] if {$static::ErrorDebug == 1} { log local0. "\$HTTP_HOST = $HTTP_HOST, \$HTTP_URI = $HTTP_URI, \$HTTP_METHOD = $HTTP_METHOD, \$VSPool = $VSPool" } if { [active_members $VSPool] < 1 } { LB::detach log local0. "Client [IP::client_addr] requested [HTTP::host][HTTP::uri] no active nodes available." No pool members available. Setting error flag. set pool_error 1 } } when HTTP_RESPONSE priority 100 { Catch Bad Application Errors and set relevant error flag if { $HTTP_METHOD == "GET" } { if { [HTTP::status] == 404 or [HTTP::status] == 500 or [HTTP::status] == 502 or [HTTP::status] == 503 } { log local0.info "Error encountered. Returning unavailable page. Request details: HTTP_HOST=$HTTP_HOST, HTTP_URI=$HTTP_URI, HTTP_METHOD=$HTTP_METHOD, VSPool=$VSPool, HTTP_Status=[HTTP::status]" set response_error 1 return } } }
- hooleylistCirrostratusThat iRule on its own shouldn't prevent other iRules from firing. Do your other iRules read the $response_error or $pool_error variables?
- GavinW_29074NimbostratusAaron
when RULE_INIT { set static::RespondDebug 1 Static iFile content set static::unavailable_page [ifile get unavailable_page_html] set static::offline_page [ifile get offline_page_html] set static::secure_failure_page [ifile get secure_connection_failure_html] set static::act_logo [ifile get act_logo_png] } when CLIENT_ACCEPTED priority 1 { if {$static::RespondDebug > 0} { log local0. "Processing CLIENT_ACCEPTED at priority 1" } Set-up base variables. set pool_error 0 set maintenance_mode 0 set ssl_error 0 set failure_result "" set response_error 0 if {$static::RespondDebug > 0} { log local0. "Variables set:- \$pool_error = $pool_error, \$maintenance_mode = $maintenance_mode, \$ssl_error = $ssl_error, \$failure_result = '$failure_result', \$response_error = $response_error" } } when HTTP_REQUEST priority 20 { Variable set-up. set vname "[findstr [string range [virtual name] [string last / [virtual name]] end] "/" 1 "_"]" set host "[HTTP::host]" set uri "[HTTP::uri]" set errors_prefix "VS=$vname, Host=$host, URI=$uri" if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Processing HTTP_REQUEST at Priority 20..." } if {$static::RespondDebug > 0} { log local0. "$errors_prefix: \$maintenance_mode = $maintenance_mode, \$ssl_error = $ssl_error, \$failure_result = '$failure_result'" } Catch ACT Logo and return. if { [HTTP::uri] ends_with "logo-act.png" } { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Returning ACT Logo..." } HTTP::respond 200 content $static::act_logo "Content-Type" "image/png" "Connection" "Close" "Cache-Control" "no-cache" TCP::close event disable return } Catch Scheme Logo(s) and return. if { [HTTP::uri] ends_with "_logo.jpg" } { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Returning Scheme Specific Logo's..." } Set-up iFile name. set ifile_name "scheme_error_logo_" set scheme_ref [class lookup $vname Scheme_Error_VIP_Names] append ifile_name $scheme_ref append ifile_name "_" Get Logo name from URI set logo_name [string trim [getfield [HTTP::uri] "/" 3] "_logo.jpg"] append ifile_name $logo_name if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Logo name is: '$ifile_name'" } Get iFile content catch {ifile get $ifile_name} response_content if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Response content is: '$response_content'" } if { $response_content == "" } { log local0.info "$errors_prefix: Logo not found..." HTTP::respond 200 "Connection" "Close" "Cache-Control" "no-cache" } else { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Returning logo..." } HTTP::respond 200 content $response_content "Content-Type" "image/jpg" "Connection" "Close" "Cache-Control" "no-cache" } TCP::close event disable return } Handle maintenance mode. if {$maintenance_mode} { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Returning Maintenance page html..." } switch -glob [HTTP::method] { POST { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: POST Method - Returning Code 503" } HTTP::respond 503 event disable return } GET { Scheme specific error page handling. if {$static::RespondDebug > 0} { log local0. "$errors_prefix: GET Method - Checking for Custom error page" } if { [class match $vname eq Scheme_Error_VIP_Names] } { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: $vname found in Scheme_Error_VIP_Names" } set scheme_ref [class lookup $vname Scheme_Error_VIP_Names] if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Scheme reference is: '$scheme_ref'" } set response_html [ifile get scheme_error_html_$scheme_ref] HTTP::respond 200 content $response_html "Content-Type" "text/html" "Cache-Control" "no-cache" } else { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: $vname not found in Scheme_Error_VIP_Names" } HTTP::respond 200 content $static::offline_page "Content-Type" "text/html" "Cache-Control" "no-cache" } event disable return } } TCP::close } Handle SSL error if {$ssl_error} { if {$static::RespondDebug > 0} { log local0. "Returning SSL Error page html..." } HTTP::respond 403 content [subst $static::secure_failure_page] "Content-Type" "text/html" "Connection" "Close" TCP::close event disable return } } when HTTP_REQUEST priority 750 { if {$static::RespondDebug > 0} { log local0. "Processing HTTP_REQUEST at Priority 750..." } if {$static::RespondDebug > 0} { log local0. "\$pool_error = $pool_error" } Handle error page. if {$pool_error} { switch -glob [HTTP::method] { POST { if {$static::RespondDebug > 0} { log local0. "POST Method - Returning Code 503" } HTTP::respond 503 event disable return } GET { Scheme specific error page handling. if {$static::RespondDebug > 0} { log local0. "$errors_prefix: GET Method - Checking for Custom error page" } if { [class match $vname eq Scheme_Error_VIP_Names] } { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: $vname found in Scheme_Error_VIP_Names" } set scheme_ref [class lookup $vname Scheme_Error_VIP_Names] if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Scheme reference is: '$scheme_ref'" } set response_html [ifile get scheme_error_html_$scheme_ref] HTTP::respond 200 content $response_html "Content-Type" "text/html" "Cache-Control" "no-cache" } else { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: $vname not found in Scheme_Error_VIP_Names" } HTTP::respond 200 content $static::unavailable_page "Content-Type" "text/html" "Cache-Control" "no-cache" } event disable return } } TCP::close } if {$static::RespondDebug > 0} { log local0. "Passed error checking... Continuing..." } return } when HTTP_RESPONSE priority 250 { if {$static::RespondDebug > 0} { log local0. "Processing HTTP_RESPONSE... at Priority 250" } if {$static::RespondDebug > 0} { log local0. "\$response_error = $response_error" } if {$response_error} { switch -glob [string toupper $HTTP_METHOD] { "POST" { if {$static::RespondDebug > 0} { log local0. "POST Method - Returning Code 503" } HTTP::respond 503 event disable return } "GET" { Scheme specific error page handling. if {$static::RespondDebug > 0} { log local0. "$errors_prefix: GET Method - Checking for Custom error page" } if { [class match $vname eq Scheme_Error_VIP_Names] } { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: $vname found in Scheme_Error_VIP_Names" } set scheme_ref [class lookup $vname Scheme_Error_VIP_Names] if {$static::RespondDebug > 0} { log local0. "$errors_prefix: Scheme reference is: '$scheme_ref'" } set response_html [ifile get scheme_error_html_$scheme_ref] HTTP::respond 200 content $response_html "Content-Type" "text/html" "Cache-Control" "no-cache" } else { if {$static::RespondDebug > 0} { log local0. "$errors_prefix: $vname not found in Scheme_Error_VIP_Names" } HTTP::respond 200 content $static::unavailable_page "Content-Type" "text/html" "Cache-Control" "no-cache" } event disable return } } } }
- GavinW_29074NimbostratusAll
when RULE_INIT { set static::CatchErrorsDebug 0 } when HTTP_REQUEST priority 50 { if {$static::CatchErrorsDebug == 1} { log local0. "CatchErrors HTTP Request at Priority 50:" } set VSPool [LB::server pool] if { [active_members $VSPool] < 1 } { LB::detach log local0. "Client [IP::client_addr] requested $host$uri no active nodes available." No pool members available. Setting error flag. set pool_error 1 return } if {$static::CatchErrorsDebug == 1} { log local0. "Active Pool members [active_members $VSPool] > 0. Continuing..." } } when HTTP_RESPONSE priority 100 { if {$static::CatchErrorsDebug == 1} { log local0. "CatchErrors HTTP Response at Priority 100:" } Catch Bad Application Errors and set relevant error flag if { $method == "GET" } { if { [HTTP::status] == 404 or [HTTP::status] == 500 or [HTTP::status] == 502 or [HTTP::status] == 503 } { set ERROR_STATUS [HTTP::status] log local0.info "Error encountered. Returning unavailable page. Request details: Host=$host, URI=$uri, METHOD=$method, ClientIP=$clientip VSPool=$VSPool, HTTP_Status=$ERROR_STATUS" set response_error 1 return } } }
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