mirror of https://github.com/nginx/nginx
Proxy: added HTTP/2 proxy module.
The module allows to use HTTP/2 protocol for proxying.
HTTP/2 proxying is enabled by specifying "proxy_http_version 2".
Example:
server {
listen 8000;
location / {
proxy_http_version 2;
proxy_pass https://127.0.0.1:8443;
}
}
server {
listen 8443 ssl;
http2 on;
ssl_certificate certs/example.com.crt;
ssl_certificate_key certs/example.com.key;
location / {
return 200 foo;
}
}
This commit is contained in:
parent
90a4fc7935
commit
9bf758ea4d
11
auto/modules
11
auto/modules
|
|
@ -781,6 +781,17 @@ if [ $HTTP = YES ]; then
|
||||||
. auto/module
|
. auto/module
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $HTTP_PROXY = YES -a $HTTP_V2 = YES ]; then
|
||||||
|
ngx_module_name=ngx_http_proxy_v2_module
|
||||||
|
ngx_module_incs=
|
||||||
|
ngx_module_deps=
|
||||||
|
ngx_module_srcs=src/http/modules/ngx_http_proxy_v2_module.c
|
||||||
|
ngx_module_libs=
|
||||||
|
ngx_module_link=$HTTP_V2
|
||||||
|
|
||||||
|
. auto/module
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $HTTP_PERL != NO ]; then
|
if [ $HTTP_PERL != NO ]; then
|
||||||
ngx_module_name=ngx_http_perl_module
|
ngx_module_name=ngx_http_perl_module
|
||||||
ngx_module_incs=src/http/modules/perl
|
ngx_module_incs=src/http/modules/perl
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,9 @@ static ngx_conf_post_t ngx_http_proxy_ssl_conf_command_post =
|
||||||
static ngx_conf_enum_t ngx_http_proxy_http_version[] = {
|
static ngx_conf_enum_t ngx_http_proxy_http_version[] = {
|
||||||
{ ngx_string("1.0"), NGX_HTTP_VERSION_10 },
|
{ ngx_string("1.0"), NGX_HTTP_VERSION_10 },
|
||||||
{ ngx_string("1.1"), NGX_HTTP_VERSION_11 },
|
{ ngx_string("1.1"), NGX_HTTP_VERSION_11 },
|
||||||
|
#if (NGX_HTTP_V2)
|
||||||
|
{ ngx_string("2"), NGX_HTTP_VERSION_20 },
|
||||||
|
#endif
|
||||||
{ ngx_null_string, 0 }
|
{ ngx_null_string, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -875,6 +878,14 @@ ngx_http_proxy_handler(ngx_http_request_t *r)
|
||||||
ngx_http_proxy_main_conf_t *pmcf;
|
ngx_http_proxy_main_conf_t *pmcf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
|
||||||
|
|
||||||
|
#if (NGX_HTTP_V2)
|
||||||
|
if (plcf->http_version == NGX_HTTP_VERSION_20) {
|
||||||
|
return ngx_http_proxy_v2_handler(r);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ngx_http_upstream_create(r) != NGX_OK) {
|
if (ngx_http_upstream_create(r) != NGX_OK) {
|
||||||
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -888,8 +899,6 @@ ngx_http_proxy_handler(ngx_http_request_t *r)
|
||||||
|
|
||||||
ngx_http_set_ctx(r, ctx, ngx_http_proxy_module);
|
ngx_http_set_ctx(r, ctx, ngx_http_proxy_module);
|
||||||
|
|
||||||
plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
|
|
||||||
|
|
||||||
u = r->upstream;
|
u = r->upstream;
|
||||||
|
|
||||||
if (plcf->proxy_lengths == NULL) {
|
if (plcf->proxy_lengths == NULL) {
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,10 @@ ngx_int_t ngx_http_proxy_rewrite_redirect(ngx_http_request_t *r,
|
||||||
ngx_int_t ngx_http_proxy_rewrite_cookie(ngx_http_request_t *r,
|
ngx_int_t ngx_http_proxy_rewrite_cookie(ngx_http_request_t *r,
|
||||||
ngx_table_elt_t *h);
|
ngx_table_elt_t *h);
|
||||||
|
|
||||||
|
#if (NGX_HTTP_V2)
|
||||||
|
ngx_int_t ngx_http_proxy_v2_handler(ngx_http_request_t *r);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern ngx_module_t ngx_http_proxy_module;
|
extern ngx_module_t ngx_http_proxy_module;
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue