socketify.py icon indicating copy to clipboard operation
socketify.py copied to clipboard

Can't get rid of Server header: "uWebSockets_20"

Open wedobetter opened this issue 9 months ago • 5 comments

I have tried to overwrite it:

async def healthcheck(res: Response, _: Request, __=None):
    res.write_status(200)
    return res.end_without_body(True)

def headers_mw(res: Response, _: Request, __=None):
    return res.write_header("Server", "myserver")

basic_router = MiddlewareRouter(app, headers_mw)
basic_router.head("/health", healthcheck)

and I ended up with this:

curl -i -I http://127.0.0.1:9999/health

HTTP/1.1 200 OK
Server:  myserver
Connection: close
Date: Sat, 25 May 2024 19:52:29 GMT
Server: uWebSockets_20

wedobetter avatar May 25 '24 20:05 wedobetter