Skip to content

Possibility to disable Server header #1958

Closed
@sp-1234

Description

Long story short

By default, aiohttp server adds Server header. It should be possible to disable this, for security reasons.

Expected behaviour

No Server header in response

Actual behaviour

Server sends these headers:

Content-Type: text/plain; charset=utf-8
Content-Length: 2
Date: Tue, 06 Jun 2017 13:52:03 GMT
Server: Python/3.6 aiohttp/2.1.0

Steps to reproduce

import asyncio
from aiohttp import web


async def http_handler(request):
    return web.Response(text="OK", headers={})


def main():
    loop = asyncio.get_event_loop()
    loop.run_until_complete(loop.create_server(web.Server(http_handler), "127.0.0.1", 8080))
    loop.run_forever()


if __name__ == "__main__":
    main()

Your environment

macOS 10.12.5
Python 3.6.1

$ pip3 freeze
aiofiles==0.3.0
aiohttp==2.1.0
async-timeout==1.2.1
asyncio==3.4.3
chardet==3.0.3
Cython==0.25.2
defusedxml==0.5.0
google-api-python-client==1.6.2
httplib2==0.10.3
jira==1.0.10
llvmlite==0.16.0
magicmemoryview==0.1.5
multidict==2.1.6
numba==0.31.0
numexpr==2.6.2
numpy==1.12.0
oauth2client==4.1.0
oauthlib==2.0.2
pbr==3.0.1
pyasn1==0.2.3
pyasn1-modules==0.0.8
requests==2.13.0
requests-oauthlib==0.8.0
requests-toolbelt==0.7.1
rsa==3.4.2
six==1.10.0
tornado==4.4.2
uritemplate==3.0.0
websockets==3.3
yarl==0.10.2

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions