-*- 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]
apr_uri_t puri;
const char *authority, *scheme, *path;
apr_status_t status;
+ proxy_dir_conf *dconf;
stream = apr_pcalloc(r->pool, sizeof(*stream));
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);
/* 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);
}