diff options
author | Roman Arutyunyan <arut@nginx.com> | 2024-11-15 08:23:53 +0400 |
---|---|---|
committer | Roman Arutyunyan <arutyunyan.roman@gmail.com> | 2025-06-19 10:19:57 +0400 |
commit | 662c1dd2a97afd6c7ca09b8f5a74347ee017b86b (patch) | |
tree | d1d7ada1eb9149fc10c77e4aa73892b7a9863a54 /src/http/modules/ngx_http_grpc_module.c | |
parent | ea001feb10a294ccd53c896b9919f17f5cbda468 (diff) | |
download | nginx-662c1dd2a97afd6c7ca09b8f5a74347ee017b86b.tar.gz nginx-662c1dd2a97afd6c7ca09b8f5a74347ee017b86b.zip |
Upstream: early hints support.
The change implements processing upstream early hints response in
ngx_http_proxy_module and ngx_http_grpc_module. A new directive
"early_hints" enables sending early hints to the client. By default,
sending early hints is disabled.
Example:
map $http_sec_fetch_mode $early_hints {
navigate $http2$http3;
}
early_hints $early_hints;
proxy_pass http://example.com;
Diffstat (limited to 'src/http/modules/ngx_http_grpc_module.c')
-rw-r--r-- | src/http/modules/ngx_http_grpc_module.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c index 80046d6a4..d74b17708 100644 --- a/src/http/modules/ngx_http_grpc_module.c +++ b/src/http/modules/ngx_http_grpc_module.c @@ -1869,7 +1869,8 @@ ngx_http_grpc_process_header(ngx_http_request_t *r) return NGX_HTTP_UPSTREAM_INVALID_HEADER; } - if (status < NGX_HTTP_OK) { + if (status < NGX_HTTP_OK && status != NGX_HTTP_EARLY_HINTS) + { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent unexpected :status \"%V\"", status_line); @@ -1902,6 +1903,10 @@ ngx_http_grpc_process_header(ngx_http_request_t *r) h->lowcase_key = h->key.data; h->hash = ngx_hash_key(h->key.data, h->key.len); + if (u->headers_in.status_n == NGX_HTTP_EARLY_HINTS) { + continue; + } + hh = ngx_hash_find(&umcf->headers_in_hash, h->hash, h->lowcase_key, h->key.len); @@ -4413,6 +4418,7 @@ ngx_http_grpc_create_loc_conf(ngx_conf_t *cf) conf->upstream.pass_request_body = 1; conf->upstream.force_ranges = 0; conf->upstream.pass_trailers = 1; + conf->upstream.pass_early_hints = 1; conf->upstream.preserve_output = 1; conf->headers_source = NGX_CONF_UNSET_PTR; |