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