41a6c3
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
41a6c3
index 81fd14c..cd1710f 100644
41a6c3
--- a/modules/proxy/mod_proxy.h
41a6c3
+++ b/modules/proxy/mod_proxy.h
41a6c3
@@ -856,6 +856,17 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
41a6c3
 PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
41a6c3
                                               proxy_conn_rec *conn,
41a6c3
                                               conn_rec *c, server_rec *s);
41a6c3
+
41a6c3
+/**
41a6c3
+ * Determine if proxy connection can potentially be reused at the
41a6c3
+ * end of this request.
41a6c3
+ * @param conn proxy connection
41a6c3
+ * @return non-zero if reusable, 0 otherwise
41a6c3
+ * @note Even if this function returns non-zero, the connection may
41a6c3
+ * be subsequently marked for closure.
41a6c3
+ */
41a6c3
+PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn);
41a6c3
+
41a6c3
 /**
41a6c3
  * Signal the upstream chain that the connection to the backend broke in the
41a6c3
  * middle of the response. This is done by sending an error bucket with
41a6c3
diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c
41a6c3
index 0f84416..c57696a 100644
41a6c3
--- a/modules/proxy/mod_proxy_fcgi.c
41a6c3
+++ b/modules/proxy/mod_proxy_fcgi.c
41a6c3
@@ -247,7 +247,7 @@ static apr_status_t send_begin_request(proxy_conn_rec *conn, int request_id)
41a6c3
 
41a6c3
     brb.roleB1 = ((FCGI_RESPONDER >> 8) & 0xff);
41a6c3
     brb.roleB0 = ((FCGI_RESPONDER) & 0xff);
41a6c3
-    brb.flags = FCGI_KEEP_CONN;
41a6c3
+    brb.flags = ap_proxy_connection_reusable(conn) ? FCGI_KEEP_CONN : 0;
41a6c3
     brb.reserved[0] = 0;
41a6c3
     brb.reserved[1] = 0;
41a6c3
     brb.reserved[2] = 0;
41a6c3
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
41a6c3
index 8bc9fab..ca70ae4 100644
41a6c3
--- a/modules/proxy/proxy_util.c
41a6c3
+++ b/modules/proxy/proxy_util.c
41a6c3
@@ -1333,6 +1333,13 @@ static void init_conn_pool(apr_pool_t *p, proxy_worker *worker)
41a6c3
     worker->cp = cp;
41a6c3
 }
41a6c3
 
41a6c3
+PROXY_DECLARE(int) ap_proxy_connection_reusable(proxy_conn_rec *conn)
41a6c3
+{
41a6c3
+    proxy_worker *worker = conn->worker;
41a6c3
+
41a6c3
+    return ! (conn->close || !worker->s->is_address_reusable || worker->s->disablereuse);
41a6c3
+}
41a6c3
+
41a6c3
 static apr_status_t connection_cleanup(void *theconn)
41a6c3
 {
41a6c3
     proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
41a6c3
@@ -1361,7 +1368,7 @@ static apr_status_t connection_cleanup(void *theconn)
41a6c3
     }
41a6c3
 
41a6c3
     /* determine if the connection need to be closed */
41a6c3
-    if (conn->close || !worker->s->is_address_reusable || worker->s->disablereuse) {
41a6c3
+    if (!ap_proxy_connection_reusable(conn)) {
41a6c3
         apr_pool_t *p = conn->pool;
41a6c3
         apr_pool_clear(p);
41a6c3
         conn = apr_pcalloc(p, sizeof(proxy_conn_rec));