question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having a Hard Time Replacing Default Server Header

See original GitHub issue

Hello;

I’m using uvicorn to front-end an ASGI application of mine and I’m loving it! There is only one slight marring of the beautiful steed which is uvicorn; I have been unable to find a means whereby I can over-ride the sending of the Server: uvicorn header on all outbound responses.

When using HTTP1.1 as the transport protocol, I see in the uvicorn.protocols.http.h11_impl module a _get_default_headers function. I can see that this in turn gets called by H11Protocol#tick, which overrides whatever value that the global DEFAULT_HEADERS variable holds, which in turn is what gets augmented to the headers of every outbound request in the RequestResponseCycle#send method.

Is there a strong reason for this? If not, is there any desire with the existing devs to enable this to be disabled/changed? Or, is there a desired approach that someone else should take if they would wish to introduce a PR that would change this behaviour?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
tomchristiecommented, Feb 14, 2019

Yup - it’d be available as part of the Config

0reactions
Jitsusamacommented, Mar 15, 2019

PR has been merged which resolves this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hardening your HTTP response headers - Scott Helme
The first, and easiest way is to check in the HTTP Response Headers section. If the X-Powered-By header is present here, you can...
Read more >
Server-Timing - HTTP - MDN Web Docs
The Server-Timing header communicates one or more metrics and descriptions for a given request-response cycle.
Read more >
Changing default SERVER header - Help - Caddy Community
I'm running Caddy v0.11.5, and believe I have identified an anomaly in the behavior of how the “Server” header is handled.
Read more >
How do you change the server header returned by nginx?
Another quick fix (for version 1.7.8) to completely remove the server header is: comment out lines 49 and 50 (corresponding to lines 48,...
Read more >
HTTP security headers: An easy way to harden your web ...
Setting suitable headers in your web applications and web server settings is an easy way to greatly improve the resilience of your web ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found