Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sample
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周韬
node-sample
Commits
89854ad0
Commit
89854ad0
authored
Mar 27, 2018
by
Pooya Parsa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http2 push and cache-control age
parent
bd183e00
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
cache.js
common/cache.js
+1
-1
nuxt.config.js
nuxt.config.js
+4
-1
No files found.
common/cache.js
View file @
89854ad0
...
@@ -4,7 +4,7 @@ import apicache from "apicache"
...
@@ -4,7 +4,7 @@ import apicache from "apicache"
const
app
=
express
()
const
app
=
express
()
// https://github.com/kwhitley/apicache
// https://github.com/kwhitley/apicache
app
.
use
(
apicache
.
middleware
(
"5 minutes"
))
app
.
use
(
apicache
.
middleware
(
"
1
5 minutes"
))
// apicache.options({ debug: true })
// apicache.options({ debug: true })
...
...
nuxt.config.js
View file @
89854ad0
...
@@ -33,11 +33,14 @@ export default {
...
@@ -33,11 +33,14 @@ export default {
plugins
:
[
"~/plugins/filters"
],
plugins
:
[
"~/plugins/filters"
],
serverMiddleware
:
[
"~/common/cache.js"
],
serverMiddleware
:
[
"~/common/cache.js"
],
render
:
{
render
:
{
http2
:
{
push
:
true
},
static
:
{
static
:
{
maxAge
:
"1y"
,
maxAge
:
"1y"
,
setHeaders
(
res
,
path
)
{
setHeaders
(
res
,
path
)
{
if
(
path
.
includes
(
"sw.js"
))
{
if
(
path
.
includes
(
"sw.js"
))
{
res
.
setHeader
(
"Cache-Control"
,
"public, max-age=0"
)
res
.
setHeader
(
"Cache-Control"
,
`public, max-age=
${
15
*
60
}
`
)
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment