-
Notifications
You must be signed in to change notification settings - Fork 28.2k
Add X-Powered-By header. #416
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
This feels like a bad idea - in general you don't want to leak information about the server in any production app - the framework name is bad enough, the exact version is worse because it makes it that much easier to target exploits. |
@@ -102,6 +104,7 @@ export async function renderErrorJSON (err, res, { dir = process.cwd(), dev = fa | |||
export function sendHTML (res, html) { | |||
res.setHeader('Content-Type', 'text/html') | |||
res.setHeader('Content-Length', Buffer.byteLength(html)) | |||
res.setHeader('X-Powered-By', `Next.js ${pkg.version}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use pkg.name
to DRY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it only says next
. Not Next.js
.
Yeah, +1 for obfuscating the version. Tho if the page downloads |
Securing apps via This is something Express does all the times. What they have a way to turn it off. I'll think about something like that. |
All major web servers do this. |
And a test would be nice to add as well! |
@rauchg added some test cases. |
See: