]> granicus.if.org Git - apache/commitdiff
On the trunk:
authorStefan Eissing <icing@apache.org>
Sun, 19 Feb 2017 21:02:26 +0000 (21:02 +0000)
committerStefan Eissing <icing@apache.org>
Sun, 19 Feb 2017 21:02:26 +0000 (21:02 +0000)
mod_proxy_http2: support for ProxyPreserverHost directive.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783693 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http2/h2_proxy_session.c
modules/http2/mod_proxy_http2.c

diff --git a/CHANGES b/CHANGES
index 014d4ed4156b9e7befa2e37f6343fc77da352ff9..a1e9bdadea938badc0be742932e4f4d5edba3305 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy_http2: support for ProxyPreserverHost directive. [Stefan Eissing]
+  
   *) mod_proxy_fcgi: Add ProxyFCGISetEnvIf to fixup CGI environment
      variables just before invoking the FastCGI. [Eric Covener,
      Jacob Champion]
index 7d28699a373270ae9472c74a29ed56da451c75a0..49476e965b75bb0ea8b4f4b7634e20c73123c362 100644 (file)
@@ -697,6 +697,7 @@ static apr_status_t open_stream(h2_proxy_session *session, const char *url,
     apr_uri_t puri;
     const char *authority, *scheme, *path;
     apr_status_t status;
+    proxy_dir_conf *dconf;
 
     stream = apr_pcalloc(r->pool, sizeof(*stream));
 
@@ -715,14 +716,22 @@ static apr_status_t open_stream(h2_proxy_session *session, const char *url,
     status = apr_uri_parse(stream->pool, url, &puri);
     if (status != APR_SUCCESS)
         return status;
-
+    
     scheme = (strcmp(puri.scheme, "h2")? "http" : "https");
-    authority = puri.hostname;
-    if (!ap_strchr_c(authority, ':') && puri.port
-        && apr_uri_port_of_scheme(scheme) != puri.port) {
-        /* port info missing and port is not default for scheme: append */
-        authority = apr_psprintf(stream->pool, "%s:%d", authority, puri.port);
+    
+    dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
+    if (dconf->preserve_host) {
+        authority = r->hostname;
     }
+    else {
+        authority = puri.hostname;
+        if (!ap_strchr_c(authority, ':') && puri.port
+            && apr_uri_port_of_scheme(scheme) != puri.port) {
+            /* port info missing and port is not default for scheme: append */
+            authority = apr_psprintf(stream->pool, "%s:%d", authority, puri.port);
+        }
+    }
+    
     /* we need this for mapping relative uris in headers ("Link") back
      * to local uris */
     stream->real_server_uri = apr_psprintf(stream->pool, "%s://%s", scheme, authority); 
index f9a3b31cc7648a7a305fdf58f5249c4f5c30b429..437fecc1c5a5a84567ca7425d1f9874368a96a22 100644 (file)
@@ -577,6 +577,10 @@ run_connect:
             /* New conection: set a note on the connection what CN is
              * requested and what protocol we want */
             if (ctx->p_conn->ssl_hostname) {
+                ap_log_cerror(APLOG_MARK, APLOG_TRACE1, status, ctx->owner, 
+                              "set SNI to %s for (%s)", 
+                              ctx->p_conn->ssl_hostname, 
+                              ctx->p_conn->hostname);
                 apr_table_setn(ctx->p_conn->connection->notes,
                                "proxy-request-hostname", ctx->p_conn->ssl_hostname);
             }