ee11bde
diff --git a/modules/proxy/ajp.h b/modules/proxy/ajp.h
ee11bde
index c119a7e..267150a 100644
ee11bde
--- a/modules/proxy/ajp.h
ee11bde
+++ b/modules/proxy/ajp.h
ee11bde
@@ -413,12 +413,14 @@ apr_status_t ajp_ilink_receive(apr_socket_t *sock, ajp_msg_t *msg);
ee11bde
  * @param sock      backend socket
c58fda3
  * @param r         current request
c58fda3
  * @param buffsize  max size of the AJP packet.
c58fda3
+ * @param secret    authentication secret
ee11bde
  * @param uri       requested uri
c58fda3
  * @return          APR_SUCCESS or error
c58fda3
  */
c58fda3
 apr_status_t ajp_send_header(apr_socket_t *sock, request_rec *r,
c58fda3
                              apr_size_t buffsize,
c58fda3
-                             apr_uri_t *uri);
c58fda3
+                             apr_uri_t *uri,
c58fda3
+                             const char *secret);
c58fda3
 
c58fda3
 /**
c58fda3
  * Read the ajp message and return the type of the message.
ee11bde
diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c
ee11bde
index 67353a7..680a8f3 100644
ee11bde
--- a/modules/proxy/ajp_header.c
ee11bde
+++ b/modules/proxy/ajp_header.c
ee11bde
@@ -213,7 +213,8 @@ AJPV13_REQUEST/AJPV14_REQUEST=
c58fda3
 
c58fda3
 static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
c58fda3
                                           request_rec *r,
c58fda3
-                                          apr_uri_t *uri)
c58fda3
+                                          apr_uri_t *uri,
c58fda3
+                                          const char *secret)
c58fda3
 {
c58fda3
     int method;
c58fda3
     apr_uint32_t i, num_headers = 0;
ee11bde
@@ -293,17 +294,15 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
c58fda3
                    i, elts[i].key, elts[i].val);
c58fda3
     }
c58fda3
 
c58fda3
-/* XXXX need to figure out how to do this
c58fda3
-    if (s->secret) {
c58fda3
+    if (secret) {
c58fda3
         if (ajp_msg_append_uint8(msg, SC_A_SECRET) ||
c58fda3
-            ajp_msg_append_string(msg, s->secret)) {
c58fda3
+            ajp_msg_append_string(msg, secret)) {
c58fda3
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(03228)
c58fda3
-                   "Error ajp_marshal_into_msgb - "
c58fda3
+                   "ajp_marshal_into_msgb: "
c58fda3
                    "Error appending secret");
c58fda3
             return APR_EGENERAL;
c58fda3
         }
c58fda3
     }
c58fda3
- */
c58fda3
 
c58fda3
     if (r->user) {
c58fda3
         if (ajp_msg_append_uint8(msg, SC_A_REMOTE_USER) ||
ee11bde
@@ -671,7 +670,8 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
c58fda3
 apr_status_t ajp_send_header(apr_socket_t *sock,
c58fda3
                              request_rec *r,
c58fda3
                              apr_size_t buffsize,
c58fda3
-                             apr_uri_t *uri)
c58fda3
+                             apr_uri_t *uri,
c58fda3
+                             const char *secret)
c58fda3
 {
c58fda3
     ajp_msg_t *msg;
c58fda3
     apr_status_t rc;
ee11bde
@@ -683,7 +683,7 @@ apr_status_t ajp_send_header(apr_socket_t *sock,
c58fda3
         return rc;
c58fda3
     }
c58fda3
 
c58fda3
-    rc = ajp_marshal_into_msgb(msg, r, uri);
c58fda3
+    rc = ajp_marshal_into_msgb(msg, r, uri, secret);
c58fda3
     if (rc != APR_SUCCESS) {
c58fda3
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00988)
c58fda3
                "ajp_send_header: ajp_marshal_into_msgb failed");
ee11bde
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c
fd6452a
index f6fb473..f693f63 100644
ee11bde
--- a/modules/proxy/mod_proxy.c
ee11bde
+++ b/modules/proxy/mod_proxy.c
fd6452a
@@ -314,6 +314,12 @@ static const char *set_worker_param(apr_pool_t *p,
fd6452a
                                 (int)sizeof(worker->s->upgrade));
fd6452a
         }
c58fda3
     }
c58fda3
+    else if (!strcasecmp(key, "secret")) {
c58fda3
+        if (PROXY_STRNCPY(worker->s->secret, val) != APR_SUCCESS) {
c58fda3
+            return apr_psprintf(p, "Secret length must be < %d characters",
c58fda3
+                                (int)sizeof(worker->s->secret));
c58fda3
+        }
c58fda3
+    }
c58fda3
     else {
c58fda3
         if (set_worker_hc_param_f) {
c58fda3
             return set_worker_hc_param_f(p, s, worker, key, val, NULL);
ee11bde
diff --git a/modules/proxy/mod_proxy.h b/modules/proxy/mod_proxy.h
fd6452a
index 8a0ad10..f92c185 100644
ee11bde
--- a/modules/proxy/mod_proxy.h
ee11bde
+++ b/modules/proxy/mod_proxy.h
ee11bde
@@ -352,6 +352,7 @@ PROXY_WORKER_HC_FAIL )
ee11bde
 #define PROXY_WORKER_MAX_HOSTNAME_SIZE  64
ee11bde
 #define PROXY_BALANCER_MAX_HOSTNAME_SIZE PROXY_WORKER_MAX_HOSTNAME_SIZE
ee11bde
 #define PROXY_BALANCER_MAX_STICKY_SIZE  64
ee11bde
+#define PROXY_WORKER_MAX_SECRET_SIZE    64
c58fda3
 
c58fda3
 /* RFC-1035 mentions limits of 255 for host-names and 253 for domain-names,
c58fda3
  * dotted together(?) this would fit the below size (+ trailing NUL).
fd6452a
@@ -443,6 +444,7 @@ typedef struct {
ee11bde
     hcmethod_t      method;     /* method to use for health check */
ee11bde
     apr_interval_time_t interval;
fd6452a
     char      upgrade[PROXY_WORKER_MAX_SCHEME_SIZE];/* upgrade protocol used by mod_proxy_wstunnel */
c58fda3
+    char      secret[PROXY_WORKER_MAX_SECRET_SIZE]; /* authentication secret (e.g. AJP13) */
c58fda3
 } proxy_worker_shared;
c58fda3
 
c58fda3
 #define ALIGNED_PROXY_WORKER_SHARED_SIZE (APR_ALIGN_DEFAULT(sizeof(proxy_worker_shared)))
ee11bde
diff --git a/modules/proxy/mod_proxy_ajp.c b/modules/proxy/mod_proxy_ajp.c
ee11bde
index 051724e..e706518 100644
ee11bde
--- a/modules/proxy/mod_proxy_ajp.c
ee11bde
+++ b/modules/proxy/mod_proxy_ajp.c
ee11bde
@@ -193,6 +193,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
c58fda3
     apr_off_t content_length = 0;
c58fda3
     int original_status = r->status;
c58fda3
     const char *original_status_line = r->status_line;
c58fda3
+    const char *secret = NULL;
c58fda3
 
c58fda3
     if (psf->io_buffer_size_set)
c58fda3
        maxsize = psf->io_buffer_size;
ee11bde
@@ -202,12 +203,15 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
c58fda3
        maxsize = AJP_MSG_BUFFER_SZ;
c58fda3
     maxsize = APR_ALIGN(maxsize, 1024);
c58fda3
 
c58fda3
+    if (*conn->worker->s->secret)
c58fda3
+        secret = conn->worker->s->secret;
c58fda3
+
c58fda3
     /*
c58fda3
      * Send the AJP request to the remote server
c58fda3
      */
c58fda3
 
c58fda3
     /* send request headers */
c58fda3
-    status = ajp_send_header(conn->sock, r, maxsize, uri);
c58fda3
+    status = ajp_send_header(conn->sock, r, maxsize, uri, secret);
c58fda3
     if (status != APR_SUCCESS) {
c58fda3
         conn->close = 1;
c58fda3
         ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00868)