How to specify Headers for only html responses

Hi Netlify folks,

So as mentioned here you can use wildcards to specify various routes:

I wanted to ask if there is a way to target only html responses? Is there any way to specify exclude “*.js”?

There is no way to match “everything except X” in our system at present. You can of course target only html responses if your URL’s actually end with html:

/*html
  Header: value

If you could let me know what is it you’re trying to accomplish in some more detail, we might be able to come up with a way to do it that isn’t using that facility.

So I was thinking of trying out http2 push.
I have a vendor bundle loaded on every page so I thought I should use

/*
  Link </static/vendor.js> ; rel=preload; as=script

I still haven’t tested it out whether this header will get added to js, css, image and other assets as well. I would not want to serve this header to js and css assets.

Since HTTP/2 push is disabled right now and we don’t have a timeline for re-enabling, I guess that experiment probably won’t do much good for you.

Once re-enabled, we do have facilities in place to ONLY push for html files already in that case since everyone misconfigured it and was double-loading their CSS and JS files :wink:

What is the ETA for that?

Hey there, @jkool :wave:

Thanks for reaching out about this. Server push capability for http/2 still is still not enabled, and do we not have a public timeline for this. You can read about that in our Docs: HTTPS (SSL) | Netlify Docs

Please let me know if you have any additional questions!