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

How to modify default "_headers" values? #206

Open
stefanobartoletti opened this issue Jan 25, 2021 · 2 comments
Open

How to modify default "_headers" values? #206

stefanobartoletti opened this issue Jan 25, 2021 · 2 comments

Comments

@stefanobartoletti
Copy link

I'd like to modify and override some default values printend in the _headers file, but I can't find how.

To be more specific, I want to set the strict-origin-when-cross-origin as the value for Referrer-Policy, while the default configuration has origin.

I tried by passing this option object into nuxt.config.js

{
  netlify: { 
    headers: {
      '/*': [
        'Referrer-Policy: strict-origin-when-cross-origin',
      ],
    }
  }
}

but as a result, the _headers file contains two entries for Referrer-Policy, as follows:

## Created with https://github.com/juliomrqz/nuxt-netlify
/*
  Referrer-Policy: strict-origin-when-cross-origin
  Referrer-Policy: origin
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block

/_nuxt/*
  Cache-Control: public, max-age=31536000, immutable

/sw.js
  Cache-Control: no-cache

How can I replace this value instead of appending it?

@DreaMinder
Copy link

Maybe try adding this option: mergeSecurityHeaders: false

I know, this question might be outdated, but still...

@CHEWX
Copy link

CHEWX commented Apr 12, 2023

If you set to false, it removes any default ones, which is a bit annoying, as I only want to replace one, but have to set to false, so need to manually reset defaults.

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

No branches or pull requests

3 participants