nghttpx: Don't rewrite location if proxy mode is used

This commit is contained in:
Tatsuhiro Tsujikawa 2013-12-28 17:02:43 +09:00
parent c0726036b1
commit 1c43cdbbc8
3 changed files with 12 additions and 6 deletions

View File

@ -945,8 +945,10 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream)
DLOG(INFO, downstream) << "HTTP response header completed"; DLOG(INFO, downstream) << "HTTP response header completed";
} }
downstream->normalize_response_headers(); downstream->normalize_response_headers();
if(!get_config()->http2_proxy && !get_config()->client_proxy) {
downstream->rewrite_norm_location_response_header downstream->rewrite_norm_location_response_header
(get_client_handler()->get_upstream_scheme(), get_config()->port); (get_client_handler()->get_upstream_scheme(), get_config()->port);
}
downstream->concat_norm_response_headers(); downstream->concat_norm_response_headers();
auto end_headers = std::end(downstream->get_response_headers()); auto end_headers = std::end(downstream->get_response_headers());
size_t nheader = downstream->get_response_headers().size(); size_t nheader = downstream->get_response_headers().size();

View File

@ -656,8 +656,10 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream)
hdrs += http2::get_status_string(downstream->get_response_http_status()); hdrs += http2::get_status_string(downstream->get_response_http_status());
hdrs += "\r\n"; hdrs += "\r\n";
downstream->normalize_response_headers(); downstream->normalize_response_headers();
if(!get_config()->http2_proxy && !get_config()->client_proxy) {
downstream->rewrite_norm_location_response_header downstream->rewrite_norm_location_response_header
(get_client_handler()->get_upstream_scheme(), get_config()->port); (get_client_handler()->get_upstream_scheme(), get_config()->port);
}
auto end_headers = std::end(downstream->get_response_headers()); auto end_headers = std::end(downstream->get_response_headers());
http2::build_http1_headers_from_norm_headers http2::build_http1_headers_from_norm_headers
(hdrs, downstream->get_response_headers()); (hdrs, downstream->get_response_headers());

View File

@ -840,8 +840,10 @@ int SpdyUpstream::on_downstream_header_complete(Downstream *downstream)
DLOG(INFO, downstream) << "HTTP response header completed"; DLOG(INFO, downstream) << "HTTP response header completed";
} }
downstream->normalize_response_headers(); downstream->normalize_response_headers();
if(!get_config()->http2_proxy && !get_config()->client_proxy) {
downstream->rewrite_norm_location_response_header downstream->rewrite_norm_location_response_header
(get_client_handler()->get_upstream_scheme(), get_config()->port); (get_client_handler()->get_upstream_scheme(), get_config()->port);
}
size_t nheader = downstream->get_response_headers().size(); size_t nheader = downstream->get_response_headers().size();
// 6 means :status, :version and possible via header field. // 6 means :status, :version and possible via header field.
auto nv = util::make_unique<const char*[]>(nheader * 2 + 6 + 1); auto nv = util::make_unique<const char*[]>(nheader * 2 + 6 + 1);