How can I do h2 server push with firebase functions?

Viewed 457

How can I do h2 server push with firebase/google cloud functions? I want to implement something like this - h2 server push only with firebase functions. The polymer team says they did it here - Polymer HNPWA - but looking at the functions code, I don't see that they actually are. Any help/direction appreciated.

1 Answers

One way to configure H2 Server Push, is to set the 'Link' header to indicate what resources you want to preload.

You can actually do this through the firebase.json file, like its done for the Polymer HNPWA example: https://github.com/Polymer/hn-polymer-2/blob/master/firebase.json

For instance:

    "headers": [
      {
        "source": "/*",
        "headers": [{"key": "Link", "value": "</myscript.js>;rel=preload;as=script,</mydocument.html>;rel=preload;as=document"}]
      } 
    ]

indicates that for any request against /*, a push of myscript.js and mydocument.html will be triggered.

Hope it helps.

Related