-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from jagaapple/feature/add-create-secure-heade…
…rs-function # New Features - Add `createSecureHeaders` - Add an example project using `createSecureHeaders` # Changes and Fixes - Use `beforeEach` instead of `beforeAll` in assigning spy instances - Fix to reset mocks between examples - Update readme
- Loading branch information
Showing
21 changed files
with
12,797 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env* | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { createSecureHeaders } = require("next-secure-headers"); | ||
|
||
module.exports = { | ||
poweredByHeader: false, | ||
async headers() { | ||
return [ | ||
{ | ||
source: "/(.*?)", | ||
headers: createSecureHeaders({ | ||
contentSecurityPolicy: { | ||
directives: { | ||
defaultSrc: "'self'", | ||
styleSrc: ["'self'", "https://stackpath.bootstrapcdn.com"], | ||
}, | ||
}, | ||
forceHTTPSRedirect: [true, { maxAge: 60 * 60 * 24 * 4, includeSubDomains: true }], | ||
referrerPolicy: "same-origin", | ||
}), | ||
}, | ||
]; | ||
}, | ||
}; |
Oops, something went wrong.