Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 8aa84e3

Browse files
committed
fix incorrect _headers syntax & broken local cypress
1 parent dd70dc9 commit 8aa84e3

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

cypress/plugins/deployProject.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { removeSync } = require("fs-extra");
12
const waitOn = require("wait-on");
23
const execa = require("execa");
34
const { join } = require("path");
@@ -7,6 +8,9 @@ const getBaseUrl = require("./getBaseUrl");
78
const deployLocally = ({ project }, config) => {
89
process.stdout.write(`Deploying project: ${project}...`);
910

11+
// _headers breaks netlify dev
12+
removeSync(join(config.buildsFolder, project, "out_publish", "_headers"));
13+
1014
// Start server. Must start in detached mode, so that we can kill it later.
1115
// Otherwise, we seem unable to kill it.
1216
// See: https://medium.com/@almenon214/killing-processes-with-node-772ffdd19aad

lib/steps/setupHeaders.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ const setupHeaders = (publishPath) => {
1919

2020
// Add rule to override cache control for static chunks
2121
const staticChunkRule = [
22-
`/_next/static/chunks/*:`,
22+
`/*/_next/static/chunks/*`,
2323
`\n`,
2424
` `,
25-
`cache-control: public,max-age=31536000,immutable`,
25+
`cache-control: public`,
26+
`\n`,
27+
` `,
28+
`cache-control: max-age=31536000`,
29+
`\n`,
30+
` `,
31+
`cache-control: immutable`,
2632
].join("");
2733
headers.push(staticChunkRule);
2834

tests/__snapshots__/defaults.test.js.snap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
exports[`Headers creates Netlify headers 1`] = `
44
"# Next-on-Netlify Headers
5-
/_next/static/chunks/*:
6-
cache-control: public,max-age=31536000,immutable"
5+
/*/_next/static/chunks/*
6+
cache-control: public
7+
cache-control: max-age=31536000
8+
cache-control: immutable"
79
`;
810

911
exports[`Routing creates Netlify redirects 1`] = `

0 commit comments

Comments
 (0)