summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/libh2o/misc/cache-digest.js/README.md
blob: bb0649ddd8f4a387e9a9a8df6376613662738e12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
cache-digest.js
======

[![Build Status](https://travis-ci.org/h2o/cache-digest.js.svg?branch=master)](https://travis-ci.org/h2o/cache-digest.js)

[Service Worker](https://developer.mozilla.org/docs/Web/API/Service_Worker_API) implementation of [Cache Digests for HTTP/2 (draft 01)](https://tools.ietf.org/html/draft-kazuho-h2-cache-digest-01)

Warning
------

* WIP; the code is in early-beta stage
* only supports sending of _fresh_ digests without etag

How to Use
------

1. install cache-digest.js into the root directory of the website
2. add `<script src="/cache-digest.js"></script>` to your web pages
3. adjust the web server configuration to send:
 * `service-worker-allowed: /` response header
 * `link: <push-URL>; rel="preload"` response header (see [spec](https://w3c.github.io/preload/))

Calculating Digests at Command Line
------

You can run cli.js to calculate cache digests manually.

```
% node cli.js -b https://example.com/style.css https://example.com/jquery.js https://example.com/shortcut.css
EdcLLJA
```

In the above example, `-b` option is used so that the digest would be encoded using [base64url](https://tools.ietf.org/html/rfc4648#section-5). Please refer to `-h` (help) option for more information.