'alt-svc header in aiohttps for HTTP/3 support

from aiohttp import web
import ssl


async def index(request):
    return web.Response(text='<h1>Hello! This is a test page</h1>', content_type='text/html')

app = web.Application()
app.add_routes([web.get('/index', index)])

ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain(certfile="ssl_cert", keyfile="ssl_key")

if __name__ == '__main__':
    web.run_app(app, ssl_context=ssl_context)

This is a simple implementation of aiohttp server. I would like to add the support for HTTP/3 python implementation ([aioquic]https://github.com/aiortc/aioquic). For that I need to add alt-svc headers. Please advise me where to put the headers in this web server so that it can advertise HTTP/3 support.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source