upstream-proxy
A middleware for proxy a upstream resources, support local cache
Usage
const upstream = require('upstream-proxy');
app.use('/upstream', upstream({
// upstream for fetch from
origin: 'http://cdn.staticfile.org',
// upstream work dirctory for localize
root: getEnv('UPSTREAM_ROOT', ''),
// Customize a cache directory, true to cache `$TMP/.upstream-proxy/`
cache: path.join(os.tmpdir(), '.cache'),
// Localize the upstream to word dirctory
localize: true,
// Cache-Control age
maxage: '30day'
})