Opened 5 years ago
Closed 5 years ago
#1910 closed defect (duplicate)
http2_push not pushing the file
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-module | Version: | 1.17.x |
Keywords: | http2 http2_push http2_push_preload server push | Cc: | |
uname -a: | Linux myhost 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.17.5
built with OpenSSL 1.1.1d 10 Sep 2019 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-QxshzE/nginx-1.17.5=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=/build/nginx-QxshzE/nginx-1.17.5/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-QxshzE/nginx-1.17.5/debian/modules/http-dav-ext --add-dynamic-module=/build/nginx-QxshzE/nginx-1.17.5/debian/modules/http-echo --add-dynamic-module=/build/nginx-QxshzE/nginx-1.17.5/debian/modules/http-upstream-fair --add-dynamic-module=/build/nginx-QxshzE/nginx-1.17.5/debian/modules/http-subs-filter |
Description
Using http2_push directive in location block doesn't push resources. Using Link header (via add_header directive or supplied by backend) makes the browser issue a GET (preload) request, which is not the same.
Configuration file:
listen 127.0.0.1:80 http2; server_name example.com; root /var/www; index index.php index.html; error_page 404 = @notfound; http2_push_preload on; location = /manifest.json { expires 30d; http2_push /logos/logo.png; add_header Link "</logos/logo-2x.png>; rel=preload; as=image"; }
(There are many more location blocks, some with regex, some with prefix matching. Except those, there are no other directives in server{} block.)
http{} block has these, plus all the "standard" stuff.
sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 120; types_hash_max_size 2048; server_tokens off; server_names_hash_bucket_size 64; server_name_in_redirect off;
Debug log of making request to URL:
... 2019/12/30 16:52:19 [debug] 78078#78078: *22556 using configuration "=/manifest.json" ... 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http filename: "/var/www/manifest.json" ... 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 header filter 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: ":status: 304" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: "server: nginx" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: "date: Mon, 30 Dec 2019 21:52:19 GMT" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: "last-modified: Thu, 26 Dec 2019 18:53:16 GMT" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: "etag: "5e05019c-390"" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: "expires: Wed, 29 Jan 2020 21:52:19 GMT" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: "cache-control: max-age=2592000" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 output header: "link: </logos/logo-2x.png>; rel=preload; as=image" 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2:1 create HEADERS frame 00005571CFBACBA0: len:164 fin:1 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http cleanup add: 00005571CFBACCA8 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 frame out: 00005571CFBACBA0 sid:1 bl:1 len:164 2019/12/30 16:52:19 [debug] 78078#78078: *22556 writev: 173 of 173 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2:1 HEADERS frame 00005571CFBACBA0 was sent 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 frame sent: 00005571CFBACBA0 sid:1 bl:1 len:164 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http finalize request: 0, "/manifest.json?" a:1, c:1 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http request count:1 blk:0 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 close stream 1, queued 0, processing 1, pushing 0 ... 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 HEADERS frame sid:3 depends on 0 excl:0 weight:16 ... 2019/12/30 16:52:19 [debug] 78078#78078: *22556 http2 table add: ":path: /logos/logo-2x.png" ...
(observation: 'http2 preload' is not appearing after 'http2 header filter' in debug log)
Note:
See TracTickets
for help on using tickets.
This one is duplicate of #1909
Browser request timed out while creating the other ticket.