Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom headers #2062

Merged
merged 5 commits into from
Nov 19, 2024
Merged

feat: custom headers #2062

merged 5 commits into from
Nov 19, 2024

Conversation

ArnaudLigny
Copy link
Member

@ArnaudLigny ArnaudLigny commented Nov 15, 2024

This feature provide a new configuration structure to define custom HTTP headers, used by the local preview server.

It's useful to test custom Content Security or Cache Policy.

Structure:

headers:
  - source: <path prefixed with a slash>
    headers:
      - key: <key>
        value: "<value>"

Example:

headers:
  - source: /*
    headers:
      - key: X-Frame-Options
        value: "SAMEORIGIN"
      - key: X-XSS-Protection
        value: "1; mode=block"
      - key: X-Content-Type-Options
        value: "nosniff"
      - key: Content-Security-Policy
        value: "default-src 'self'; object-src 'self'; img-src 'self'"
      - key: Strict-Transport-Security
        value: "max-age=31536000; includeSubDomains; preload"
  - source: /images/*
    headers:
      - key: Cache-Control
        value: "public, max-age=31536000"
  - source: /assets/*
    headers:
      - key: Cache-Control
        value: "public, max-age=31536000"
  - source: /test.html
    headers:
      - key: Foo
        value: "bar"

@ArnaudLigny ArnaudLigny marked this pull request as ready for review November 19, 2024 19:33
@ArnaudLigny ArnaudLigny merged commit 8e3286d into master Nov 19, 2024
18 of 22 checks passed
@ArnaudLigny ArnaudLigny deleted the headers branch November 19, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant