Skip to content

Stop setting Server response header#173

Merged
cap10morgan merged 2 commits intomainfrom
feat/check-for-already-set-server-header
Feb 26, 2026
Merged

Stop setting Server response header#173
cap10morgan merged 2 commits intomainfrom
feat/check-for-already-set-server-header

Conversation

@cap10morgan
Copy link
Contributor

So that plugins (like usageLicensing) can set it to something else.

So that plugins (like usageLicensing) can set it to something else.
@cap10morgan cap10morgan requested a review from a team as a code owner February 24, 2026 22:21
server/http.ts Outdated

response.headers.set('Server', 'Harper');
if (!response.headers.has('Server')) {
response.headers.set('Server', 'Harper');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not be setting a Server header. It's a security liability, adds unnecessary bytes to responses, and provides little to no value. Is this absolutely necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally the security liability is proportionate to the amount of detail provided about version (and the ability to detect known vulnerable versions). We aren't sending versions, so that concern is greatly mitigated.

I think the main benefit/purpose is probably advertising/awareness. Seeing our name in HTTP communication could slightly increase awareness of our product. Also note that we do also change this header to report unlicensed usage of Harper, which is intended to a small deterrent to using it for production use without a license: https://github.com/HarperFast/harperdb/blob/main/server/http.ts#L277
And I assume that's where Wes is going with this, since he is working on licensing.

However, I am certainly open to removing the header for the reasons you stated. Or at least not sending the header except when we want to report lack of licensing, which makes this code simpler; we just don't set it, and harper-pro can set it when it needs to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would venture to guess that 99.99% of entities interested in the Server header are bots looking for servers to exploit. The license, or lackthereof, can be conveyed with an unassuming X-License header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I assume that's where Wes is going with this, since he is working on licensing.

Yep 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server header is nada más in 48465a1

Copy link
Member

@kriszyp kriszyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, approved again :)

@cap10morgan cap10morgan changed the title Check for already-set Server header before setting Stop setting Server response header Feb 26, 2026
@cap10morgan cap10morgan merged commit 27710dc into main Feb 26, 2026
21 of 22 checks passed
@cap10morgan cap10morgan deleted the feat/check-for-already-set-server-header branch February 26, 2026 21:18
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.

3 participants