59234c
diff --git a/modules/proxy/ajp.h b/modules/proxy/ajp.h
59234c
index c119a7e..267150a 100644
59234c
--- a/modules/proxy/ajp.h
59234c
+++ b/modules/proxy/ajp.h
59234c
@@ -413,12 +413,14 @@ apr_status_t ajp_ilink_receive(apr_socket_t *sock, ajp_msg_t *msg);
59234c
  * @param sock      backend socket
59234c
  * @param r         current request
59234c
  * @param buffsize  max size of the AJP packet.
59234c
+ * @param secret    authentication secret
59234c
  * @param uri       requested uri
59234c
  * @return          APR_SUCCESS or error
59234c
  */
59234c
 apr_status_t ajp_send_header(apr_socket_t *sock, request_rec *r,
59234c
                              apr_size_t buffsize,
59234c
-                             apr_uri_t *uri);
59234c
+                             apr_uri_t *uri,
59234c
+                             const char *secret);
59234c
 
59234c
 /**
59234c
  * Read the ajp message and return the type of the message.
59234c
diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c
59234c
index 67353a7..680a8f3 100644
59234c
--- a/modules/proxy/ajp_header.c
59234c
+++ b/modules/proxy/ajp_header.c
59234c
@@ -213,7 +213,8 @@ AJPV13_REQUEST/AJPV14_REQUEST=
59234c
 
59234c
 static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
59234c
                                           request_rec *r,
59234c
-                                          apr_uri_t *uri)
59234c
+                                          apr_uri_t *uri,
59234c
+                                          const char *secret)
59234c
 {
59234c
     int method;
59234c
     apr_uint32_t i, num_headers = 0;
59234c
@@ -293,17 +294,15 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
59234c
                    i, elts[i].key, elts[i].val);
59234c
     }
59234c
 
59234c
-/* XXXX need to figure out how to do this
59234c
-    if (s->secret) {
59234c
+    if (secret) {
59234c
         if (ajp_msg_append_uint8(msg, SC_A_SECRET) ||
59234c
-            ajp_msg_append_string(msg, s->secret)) {
59234c
+            ajp_msg_append_string(msg, secret)) {
59234c
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(03228)
59234c
-                   "Error ajp_marshal_into_msgb - "
59234c
+                   "ajp_marshal_into_msgb: "
59234c
                    "Error appending secret");
59234c
             return APR_EGENERAL;
59234c
         }
59234c
     }
59234c
- */
59234c
 
59234c
     if (r->user) {
59234c
         if (ajp_msg_append_uint8(msg, SC_A_REMOTE_USER) ||
59234c
@@ -671,7 +670,8 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
59234c
 apr_status_t ajp_send_header(apr_socket_t *sock,
59234c
                              request_rec *r,
59234c
                              apr_size_t buffsize,
59234c
-                             apr_uri_t *uri)
59234c
+                             apr_uri_t *uri,
59234c
+                             const char *secret)
59234c
 {
59234c
     ajp_msg_t *msg;
59234c
     apr_status_t rc;
59234c
@@ -683,7 +683,7 @@ apr_status_t ajp_send_header(apr_socket_t *sock,
59234c
         return rc;
59234c
     }
59234c
 
59234c
-    rc = ajp_marshal_into_msgb(msg, r, uri);
59234c
+    rc = ajp_marshal_into_msgb(msg, r, uri, secret);
59234c
     if (rc != APR_SUCCESS) {
59234c
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00988)
59234c
                "ajp_send_header: ajp_marshal_into_msgb failed");
59234c
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c
59234c
index 69a35ce..800ede1 100644
59234c
--- a/modules/proxy/mod_proxy.c
59234c
+++ b/modules/proxy/mod_proxy.c
59234c
@@ -327,6 +327,12 @@ static const char *set_worker_param(apr_pool_t *p,
59234c
         worker->s->response_field_size = (s ? s : HUGE_STRING_LEN);
59234c
         worker->s->response_field_size_set = 1;
59234c
     }
59234c
+    else if (!strcasecmp(key, "secret")) {
59234c
+        if (PROXY_STRNCPY(worker->s->secret, val) != APR_SUCCESS) {
59234c
+            return apr_psprintf(p, "Secret length must be < %d characters",
59234c
+                                (int)sizeof(worker->s->secret));
59234c
+        }
59234c
+    }
59234c
     else {
59234c
         if (set_worker_hc_param_f) {
59234c
             return set_worker_hc_param_f(p, s, worker, key, val, NULL);
59234c
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
59234c
index aabd09f..3419023 100644
59234c
--- a/modules/proxy/mod_proxy.h
59234c
+++ b/modules/proxy/mod_proxy.h
59234c
@@ -357,6 +357,7 @@ PROXY_WORKER_HC_FAIL )
59234c
 #define PROXY_WORKER_MAX_HOSTNAME_SIZE  64
59234c
 #define PROXY_BALANCER_MAX_HOSTNAME_SIZE PROXY_WORKER_MAX_HOSTNAME_SIZE
59234c
 #define PROXY_BALANCER_MAX_STICKY_SIZE  64
59234c
+#define PROXY_WORKER_MAX_SECRET_SIZE    64
59234c
 
59234c
 #define PROXY_RFC1035_HOSTNAME_SIZE	256
59234c
 
59234c
@@ -450,6 +451,7 @@ typedef struct {
59234c
     hcmethod_t      method;     /* method to use for health check */
59234c
     apr_interval_time_t interval;
59234c
     char      upgrade[PROXY_WORKER_MAX_SCHEME_SIZE];/* upgrade protocol used by mod_proxy_wstunnel */
59234c
+    char      secret[PROXY_WORKER_MAX_SECRET_SIZE]; /* authentication secret (e.g. AJP13) */
59234c
     char      hostname_ex[PROXY_RFC1035_HOSTNAME_SIZE];  /* RFC1035 compliant version of the remote backend address */
59234c
     apr_size_t   response_field_size; /* Size of proxy response buffer in bytes. */
59234c
     unsigned int response_field_size_set:1;
59234c
diff --git a/modules/proxy/mod_proxy_ajp.c b/modules/proxy/mod_proxy_ajp.c
59234c
index 73716af..6faabea 100644
59234c
--- a/modules/proxy/mod_proxy_ajp.c
59234c
+++ b/modules/proxy/mod_proxy_ajp.c
59234c
@@ -193,6 +193,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
59234c
     apr_off_t content_length = 0;
59234c
     int original_status = r->status;
59234c
     const char *original_status_line = r->status_line;
59234c
+    const char *secret = NULL;
59234c
 
59234c
     if (psf->io_buffer_size_set)
59234c
        maxsize = psf->io_buffer_size;
59234c
@@ -202,12 +203,15 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
59234c
        maxsize = AJP_MSG_BUFFER_SZ;
59234c
     maxsize = APR_ALIGN(maxsize, 1024);
59234c
 
59234c
+    if (*conn->worker->s->secret)
59234c
+        secret = conn->worker->s->secret;
59234c
+
59234c
     /*
59234c
      * Send the AJP request to the remote server
59234c
      */
59234c
 
59234c
     /* send request headers */
59234c
-    status = ajp_send_header(conn->sock, r, maxsize, uri);
59234c
+    status = ajp_send_header(conn->sock, r, maxsize, uri, secret);
59234c
     if (status != APR_SUCCESS) {
59234c
         conn->close = 1;
59234c
         ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00868)