Closed fuweichin closed 2 years ago
https://github.com/lwsjs/range
Let me know if you have any questions.
Actually, lws-range
is already in the default stack:
$ ws --default-stack
[
'lws-basic-auth',
'lws-body-parser',
'lws-request-monitor',
'lws-log',
'lws-cors',
'lws-json',
'lws-compress',
'lws-rewrite',
'lws-blacklist',
'lws-conditional-get',
'lws-mime',
'lws-range', <------- Range Requests
'lws-spa',
'lws-static',
'lws-index'
]
so you can launch the default server without any config changes (which uses the default stack):
$ ws
Listening on http://mbp.local:8000, http://127.0.0.1:8000, http://192.168.0.200:8000
and range requests should be accepted:
$ curl http://127.0.0.1:8000/package.json -I
HTTP/1.1 200 OK
Vary: Origin
Accept-Ranges: bytes <----- Range support
Content-Length: 1214
Last-Modified: Sat, 26 Feb 2022 21:07:54 GMT
Cache-Control: max-age=0
Content-Type: application/json; charset=utf-8
ETag: W/"4be-17f37dc8a42"
Date: Sun, 27 Feb 2022 16:25:01 GMT
To make
<audio>
/<video>
seekable, we need Range Requests on Koa static server.