parent
51f3bca3fb
commit
3d1c4ccc13
server/middleware
|
@ -78,7 +78,7 @@ function serveFile(req, res, next) {
|
||||||
// Cache modules for 1 year.
|
// Cache modules for 1 year.
|
||||||
res
|
res
|
||||||
.set({
|
.set({
|
||||||
"Content-Type": contentType,
|
"Content-Type": `${contentType}; charset=utf-8`,
|
||||||
"Content-Length": Buffer.byteLength(code),
|
"Content-Length": Buffer.byteLength(code),
|
||||||
"Cache-Control": "public, max-age=31536000",
|
"Cache-Control": "public, max-age=31536000",
|
||||||
"Cache-Tag": "file,js-file,js-module"
|
"Cache-Tag": "file,js-file,js-module"
|
||||||
|
@ -91,9 +91,10 @@ function serveFile(req, res, next) {
|
||||||
const tags = ["file"]
|
const tags = ["file"]
|
||||||
|
|
||||||
const ext = path.extname(req.filename).substr(1)
|
const ext = path.extname(req.filename).substr(1)
|
||||||
|
|
||||||
if (ext) tags.push(`${ext}-file`)
|
if (ext) tags.push(`${ext}-file`)
|
||||||
|
|
||||||
|
if (contentType === "application/javascript") contentType += "; charset=utf-8"
|
||||||
|
|
||||||
// Cache files for 1 year.
|
// Cache files for 1 year.
|
||||||
res.set({
|
res.set({
|
||||||
"Content-Type": contentType,
|
"Content-Type": contentType,
|
||||||
|
|
Loading…
Reference in New Issue