Welcome! Log In Create A New Profile

Advanced

103 Early Hints support in NGINX

Posted by elvinefendi 
103 Early Hints support in NGINX
December 10, 2021 03:45PM
HTTP/2 introduced a `push` feature that was supposed to improve page speed by pushing assets to the browser before it even requested it. But this feature never really worked because the server doesn't know what assets the browser already have in cache, so it often end up wastful. Ultimately Chrome recently announced they'll be removing support for it soon ([more context on this](https://evertpot.com/http-2-push-is-dead/)).

Now the new solution to this is 103 Early Hints: https://tools.ietf.org/html/rfc8297

Does NGINX have any plan to add support for 103 Early Hints header in response?

Current NGINX behaviour:

Apparently Nginx doesn't handle these response properly. It works well if I request it directly, but once Nginx is in the middle:

Using HTTP2:
```
$ curl -i https://early-hints-test.shopifycloud.com/
HTTP/2 103
date: Thu, 03 Dec 2020 15:45:18 GMT
link: https://example.com/script.js; rel=preload; as=script
strict-transport-security: max-age=63072000; includeSubDomains; preload
x-dc: gcp-us-central1

curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
```

Forcing HTTP/1.1, it kinda works except it buffer the response for 20 seconds:

```
$ curl --http1.1 -i https://early-hints-test.shopifycloud.com/
HTTP/1.1 103 Early Hints
Date: Thu, 03 Dec 2020 15:38:46 GMT
Connection: keep-alive
Link: https://example.com/script.js; rel=preload; as=script
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Dc: gcp-us-central1

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 259
```
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 90
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready