summaryrefslogtreecommitdiff
path: root/modules/proxy/ajp_header.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/proxy/ajp_header.c')
-rw-r--r--modules/proxy/ajp_header.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c
index 074f0a8d..8f9a2fcd 100644
--- a/modules/proxy/ajp_header.c
+++ b/modules/proxy/ajp_header.c
@@ -435,6 +435,26 @@ static apr_status_t ajp_marshal_into_msgb(ajp_msg_t *msg,
return AJP_EOVERFLOW;
}
}
+ /* Forward the local ip address information, which was forgotten
+ * from the builtin data of the AJP 13 protocol.
+ * Since the servlet spec allows to retrieve it via getLocalAddr(),
+ * we provide the address to the Tomcat connector as a request
+ * attribute. Modern Tomcat versions know how to retrieve
+ * the local address from this attribute.
+ */
+ {
+ const char *key = SC_A_REQ_LOCAL_ADDR;
+ char *val = r->connection->local_ip;
+ if (ajp_msg_append_uint8(msg, SC_A_REQ_ATTRIBUTE) ||
+ ajp_msg_append_string(msg, key) ||
+ ajp_msg_append_string(msg, val)) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02646)
+ "ajp_marshal_into_msgb: "
+ "Error appending attribute %s=%s",
+ key, val);
+ return AJP_EOVERFLOW;
+ }
+ }
/* Use the environment vars prefixed with AJP_
* and pass it to the header striping that prefix.
*/