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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.