-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: allow customizing the Server header #7338
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
Conversation
mholt
left a comment
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.
Alright, nice improvement! Thank you!
|
(To be clear, the Server header can already be set using Caddy config -- but this PR makes it possible to customize its static value which is optimized for the hot path.) |
|
Can we make it a |
|
I don't think so (and it's convenient for FrankenPHP btw 😅) |
|
With an exported var technically there's a data race |
|
It's possible to make the variable unexported, but it will be less convenient for FrankenPHP (and maybe Framer btw). |
|
The build flag still works ever on |
|
@francislavoie This is debatable. It should only called in an @mohammed90 so in FrankenPHP we can just change this variable instead of customizing our (plenty) build systems. |
|
Why's there a data race by being exported? |
|
Cause if someone writes a stupid plugin that runs during HTTP requests that tries to change the variable, it can cause race. |

Replaces php/frankenphp#1959.
May also be useful for Framer.
This allows setting the
Serverheader during build usinggo build -ldflags '-X github.com/caddyserver/caddy.ServerHeader=FooBar'This PR also micro-optimizes this code path.
Assistance Disclosure
No AI was used.