1.0.1 • Published 10 years ago
koa-addpushheader v1.0.1
koa-addpushheader
This middleware (generator function) will parse a response body for any local linked assets (CSS, images, etc) and add them to the response headers. Modern HTTP/2 reverse proxies like nghttpx parse this header and send out the required push promises to the client.
Usage
Use the library like this:
npm install --save koa-addpushheaderapp.use(require('koa-addpushheader'));
// view handling codeNotes
The header added to the response looks like this:
link: </apple-icon-57x57.png>; rel=preload, ...Currently the following file types are added:
bmp, css, eot, gif, ico, jpg, jpeg, js, otf, png, svg, ttf, webm, webp, woff, woff2
For the complete spec on rel=preload see:
http://w3c.github.io/preload/
License
This project is licensed as LGPLv3, the license file is included in the project directory.
Copyright 2015 Stefan Hamminga - prjct.net