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

Header config causes CLI to throw "invalid rule: cannot contain anything after *" #151

Closed
@ctjlewis

Description

@ctjlewis

Describe the bug
The generated _headers file contains a /*/_next/static/chunks/* rule, which throws Error: invalid rule (A path rule cannot contain anything after * token) at line: 1 when netlify dev is run.

const staticChunkRule = [
`/*/_next/static/chunks/*`,
indentNewLine(`cache-control: public`),
indentNewLine(`cache-control: max-age=31536000`),
indentNewLine(`cache-control: immutable`),
].join("");

This rule is disallowed by the CLI logic:
https://github.com/netlify/cli/blob/425e2c6eeb6a3b589370a78407b18c53f4b850bc/src/utils/headers.js#L65-L73

Does anyone have any suggestions as to how to remedy this?

To Reproduce
Steps to reproduce:

  1. Set up project
  2. Run next build to build the Next project
  3. Run next-on-netlify to build the Netlify output
  4. Run netlify dev to start dev server
  5. See error

Versions

  • Next: v10.0.5
  • next-on-netlify: 1.22.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions