0

So I'm wondering whether to enable Server Push or not.

I know that HTTP/2 upgrades from HTTP/1 which means that any client that doesn't support HTTP/2 will fall back to HTTP/1 and carry on as normal.

But what happens when a client supports HTTP/2, but doesn't support Server Push or actively denies/limits Push requests?

I'm afraid that some resources might not be transferred to the client because of this. Should I prepare for this eventuality or is it not an issue?

Howie
  • 107
  • 2
  • 7

1 Answers1

2

A client will indicate it is not push-enabled by setting SETTINGS_ENABLE_PUSH to 0 during the set up of the HTTP/2 connection.

From the HTTP/2 specification:

PUSH_PROMISE MUST NOT be sent if the SETTINGS_ENABLE_PUSH setting of the peer endpoint is set to 0. An endpoint that has set this setting and has received acknowledgement MUST treat the receipt of a PUSH_PROMISE frame as a connection error (Section 5.4.1) of type PROTOCOL_ERROR.

But HTTP/2 Push can easily be abused by site owners if they overly push assets that a client may not need, or already has cached. Clients can reset the stream to indicate they don't want the pushed resource but that's not great as it's still extra work for both client and server.

There are various methods website owners should use to ensure they only push appropriate content. I detail one such simple method in this blog post: https://www.tunetheweb.com/performance/http2/http2-push/. The HTTP Working Group are working on Cache digests which should ultimately formalise a method of doing this, but this is currently still being defined.

Barry Pollard
  • 4,591
  • 15
  • 26
  • Is SETTINGS_ENABLE_PUSH being automatically recognized by apache server and will it appropriately fallback? – Howie Sep 08 '17 at 06:12
  • @Howie I would assume so, rather than assume not since it's a MUST NOT and therefore implementations have to honour that to be compliant. It's certainly mention in the code as shown here: https://github.com/icing/mod_h2/search?q=SETTINGS_ENABLE_PUSH&type= and here: https://github.com/icing/mod_h2/search?q=h2_session_push_enabled&type= – Barry Pollard Sep 08 '17 at 06:31