]> granicus.if.org Git - apache/commitdiff
On the 2.4.x branch:
authorStefan Eissing <icing@apache.org>
Tue, 2 May 2017 15:29:13 +0000 (15:29 +0000)
committerStefan Eissing <icing@apache.org>
Tue, 2 May 2017 15:29:13 +0000 (15:29 +0000)
Merged /httpd/httpd/trunk:r1792212,1793525

mod_proxy_http2: adding support for Reverse Proxy Request headers.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1793532 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http2/h2_proxy_session.c
modules/http2/h2_version.h

diff --git a/CHANGES b/CHANGES
index 16c927344a4c0d769cf13e3bde82f79462850a74..ef22625990e648914bf0bfc3e28f278c7a897853 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.26
 
+  *) mod_proxy_http2: adding support for Reverse Proxy Request headers.
+     [Stefan Eissing]
+     
   *) mod_http2: fixed possible deadlock that could occur when connections were 
      terminated early with ongoing streams. Fixed possible hanger with timeout
      on race when connection considers itself idle. [Stefan Eissing]  
index f2fed906b7123bd3d80ff18f41d1dfcd7577b585..458a12a03c8c4989c673742e74a334fed3e91331 100644 (file)
@@ -742,6 +742,32 @@ static apr_status_t open_stream(h2_proxy_session *session, const char *url,
     h2_proxy_req_make(stream->req, stream->pool, r->method, scheme,
                 authority, path, r->headers_in);
 
+    if (dconf->add_forwarded_headers) {
+        if (PROXYREQ_REVERSE == r->proxyreq) {
+            const char *buf;
+
+            /* Add X-Forwarded-For: so that the upstream has a chance to
+             * determine, where the original request came from.
+             */
+            apr_table_mergen(stream->req->headers, "X-Forwarded-For",
+                             r->useragent_ip);
+
+            /* Add X-Forwarded-Host: so that upstream knows what the
+             * original request hostname was.
+             */
+            if ((buf = apr_table_get(r->headers_in, "Host"))) {
+                apr_table_mergen(stream->req->headers, "X-Forwarded-Host", buf);
+            }
+
+            /* Add X-Forwarded-Server: so that upstream knows what the
+             * name of this proxy server is (if there are more than one)
+             * XXX: This duplicates Via: - do we strictly need it?
+             */
+            apr_table_mergen(stream->req->headers, "X-Forwarded-Server",
+                             r->server->server_hostname);
+        }
+    }
+    
     /* Tuck away all already existing cookies */
     stream->saves = apr_table_make(r->pool, 2);
     apr_table_do(add_header, stream->saves, r->headers_out, "Set-Cookie", NULL);
index 5452296e80e84aa5d10bdad88788be4b314db58b..4f85b04382794b21e457521c04f3dc0e43edeade 100644 (file)
@@ -26,7 +26,7 @@
  * @macro
  * Version number of the http2 module as c string
  */
-#define MOD_HTTP2_VERSION "1.10.3"
+#define MOD_HTTP2_VERSION "1.10.4"
 
 /**
  * @macro
@@ -34,7 +34,7 @@
  * release. This is a 24 bit number with 8 bits for major number, 8 bits
  * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
  */
-#define MOD_HTTP2_VERSION_NUM 0x010a03
+#define MOD_HTTP2_VERSION_NUM 0x010a04
 
 
 #endif /* mod_h2_h2_version_h */