parent
90473733a5
commit
aded6f9dbc
|
@ -185,8 +185,7 @@ export default class App extends React.Component {
|
|||
<p>
|
||||
If you omit the file path (i.e. use a “bare” URL), unpkg
|
||||
will serve the file specified by the <code>unpkg</code> field in{' '}
|
||||
<code>package.json</code>, or fall back to{' '}
|
||||
<code>main</code>.
|
||||
<code>package.json</code>, or fall back to <code>main</code>.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
@ -248,16 +247,24 @@ export default class App extends React.Component {
|
|||
authors to overwrite a package that has already been published with a
|
||||
different one at the same version number.
|
||||
</p>
|
||||
<p>
|
||||
Browsers are instructed (via the <code>Cache-Control</code> header) to
|
||||
cache assets indefinitely (1 year).
|
||||
</p>
|
||||
<p>
|
||||
URLs that do not specify a package version number redirect to one that
|
||||
does. This is the <code>latest</code> version when no version is
|
||||
specified, or the <code>maxSatisfying</code> version when a{' '}
|
||||
<a href="https://github.com/npm/node-semver">semver version</a> is
|
||||
given. Redirects are cached for 5 minutes.
|
||||
given. Redirects are cached for 10 minutes at the CDN, 1 minute in
|
||||
browsers.
|
||||
</p>
|
||||
<p>
|
||||
Browsers are instructed (via the <code>Cache-Control</code> header) to
|
||||
cache assets for 1 year.
|
||||
If you're you want users to be able to use the latest version
|
||||
when you cut a new release, the best policy is to put the version
|
||||
number in the URL directly in your installation instructions. This
|
||||
will also load more quickly because we won't have to resolve the
|
||||
latest version and redirect them.
|
||||
</p>
|
||||
|
||||
<h3 css={styles.subheading} id="workflow">
|
||||
|
@ -283,8 +290,7 @@ export default class App extends React.Component {
|
|||
<a href="https://docs.npmjs.com/files/package.json#files">
|
||||
files array
|
||||
</a>{' '}
|
||||
in{' '}
|
||||
<code>package.json</code>
|
||||
in <code>package.json</code>
|
||||
</li>
|
||||
<li>
|
||||
Use a build script to generate your UMD build in the{' '}
|
||||
|
|
|
@ -10,7 +10,7 @@ function tagRedirect(req, res) {
|
|||
|
||||
res
|
||||
.set({
|
||||
'Cache-Control': 'public, s-maxage=14400, max-age=3600', // 4 hours on CDN, 1 hour on clients
|
||||
'Cache-Control': 'public, s-maxage=600, max-age=60', // 10 mins on CDN, 1 min on clients
|
||||
'Cache-Tag': 'redirect, tag-redirect'
|
||||
})
|
||||
.redirect(
|
||||
|
@ -28,7 +28,7 @@ function semverRedirect(req, res) {
|
|||
if (maxVersion) {
|
||||
res
|
||||
.set({
|
||||
'Cache-Control': 'public, s-maxage=14400, max-age=3600', // 4 hours on CDN, 1 hour on clients
|
||||
'Cache-Control': 'public, s-maxage=600, max-age=60', // 10 mins on CDN, 1 min on clients
|
||||
'Cache-Tag': 'redirect, semver-redirect'
|
||||
})
|
||||
.redirect(
|
||||
|
|
Loading…
Reference in New Issue