mod_h2
mod_h2 copied to clipboard
H2PushResource lacks "as" parameter for Link
Hi,
Is there a way to tell to H2PushResource to add the "as" parameter to the header Link of the request ?
Currently it's more efficient to manually add Link header to the response. Using H2PushResource (so without "as") force the browser to download twice the resource.
Bye.
Currently, there is no way to do that. Seems like a good addition to the config.
Using H2PushResource (so without "as") force the browser to download twice the resource.
It does not. Do you have an example?
The as attribute is more needed for the original, non-push version of the preload header to ensure it was requested correctly, so it is not really needed with Push.
Hi,
@bazzadp you are right, i forgot to remove a duplicated link, my bad.
BUT, pushing with H2PushResource is still less efficient than directly adding a Link Header. I suppose it's due to the lack of "as" parameter. I've done some performance audits using chrome and it seems that without this "as" parameter, the browser do not render immediately after reading pushed stylesheets. See screenshots for example:
I'm trying to get the best results for critical rendering path
with: Link Header
with: H2PushResource
@tlechauve I don't know if I would be as quick to close the issue. Technically, there should be no need for the as link, as I stated, but if browsers are handling the response differently based on this attribute then perhaps there is a case to add this.
There is no downside to having it (other than the work to implement it) and it could avoid confusion, so I would actually be in favour of your proposal. Apologies if my comment made it sound like I wasn't, I just was clarifying the technical side of this.
Saying that, can you confirm if the resource is definitely being pushed in both instances? Does it show as Pushed in the Network Tab->Initiator column? I've seen many instances were push is ignored, especially in development environments, as a self-signed certificate is used and so the domain is "untrusted" and the cache is therefore not used. In this case the as attribute might cause the resource still to be preloaded, whereas without it is not preloaded (another reason to support this change). So perhaps push is not being used in either case? It's kind of difficult to see from your screenshots.
Ultimately H2PushResource should be faster (http://icing.github.io/mod_h2/earlier.html) though it served from local disk the difference will be negligible.
Re-opening for future implementation of the feature. Seems easy to do.
HTTP/2 push has been turned off in Chrome.
However 103 Early Hints is being pushed (pun totally intended!!) as a replacement. This doesn't actually send the resource, but instead sends the preload hint. The browser then makes a request if it wants.
This means that having the right as attribute is actually more important - so the browser can use all these things for the subsequent request, whereas it wasn't as important for the Push case.