From e20d2ba9c1e48a1cb2326f2ec9b66abe8800bdcb Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 25 Sep 2014 00:41:38 +0900 Subject: [PATCH] nghttpx: Don't send x-forwarded-proto if -s or -p is used --- src/shrpx_http2_downstream_connection.cc | 3 ++- src/shrpx_http_downstream_connection.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shrpx_http2_downstream_connection.cc b/src/shrpx_http2_downstream_connection.cc index 3ed0a6de..22a24cc6 100644 --- a/src/shrpx_http2_downstream_connection.cc +++ b/src/shrpx_http2_downstream_connection.cc @@ -405,7 +405,8 @@ int Http2DownstreamConnection::push_request_headers() nva.push_back(http2::make_nv_ls("x-forwarded-for", (*xff).value)); } - if(downstream_->get_request_method() != "CONNECT") { + if(!get_config()->http2_proxy && !get_config()->client_proxy && + downstream_->get_request_method() != "CONNECT") { // We use same protocol with :scheme header field if(scheme.empty()) { if(client_handler_->get_ssl()) { diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index a7834490..dfd9d97b 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -221,7 +221,8 @@ int HttpDownstreamConnection::push_request_headers() http2::sanitize_header_value(hdrs, hdrs.size() - (*xff).value.size()); hdrs += "\r\n"; } - if(downstream_->get_request_method() != "CONNECT") { + if(!get_config()->http2_proxy && !get_config()->client_proxy && + downstream_->get_request_method() != "CONNECT") { hdrs += "X-Forwarded-Proto: "; if(!downstream_->get_request_http2_scheme().empty()) { hdrs += downstream_->get_request_http2_scheme();