-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hide x-opennext header from server requests when poweredByHeade…
…r is false (#567) * add: poweredByHeader can hide x-opennext header from server requests * add e2e test * add changeset * Revert "add changeset" This reverts commit 8cbd733. * add changeset in the root folder
- Loading branch information
Showing
6 changed files
with
29 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@opennextjs/aws": patch | ||
--- | ||
|
||
Hides the x-opennext header from server requests when poweredByHeader is false in next config |
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 |
---|---|---|
|
@@ -53,6 +53,7 @@ const nextConfig = { | |
}, | ||
], | ||
trailingSlash: true, | ||
poweredByHeader: true, | ||
}; | ||
|
||
module.exports = nextConfig; |
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
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,14 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
test("should test if poweredByHeader adds the correct headers ", async ({ | ||
page, | ||
}) => { | ||
const result = await page.goto("/"); | ||
expect(result).toBeDefined(); | ||
expect(result?.status()).toBe(200); | ||
const headers = result?.headers(); | ||
|
||
// Both these headers should be present cause poweredByHeader is true in pagesRouter | ||
expect(headers?.["x-powered-by"]).toBe("Next.js"); | ||
expect(headers?.["x-opennext"]).toBe("1"); | ||
}); |