[Python] Run python http.server for IPv6 only

Discussão em 'Python' iniciado por Stack, Julho 13, 2025.

  1. Stack

    Stack Membro Participativo

    python3 -m http.server --bind :: launches a python web server, as shown in Python 3: Does http.server support ipv6?. However, it also supports IPv4, because I can visit the web server with localhost:8000 (edit: even 127.0.0.1:8000 works). I don't want that. The python http.server is dual-stack even though I used --bind:


    By default, server binds itself to all interfaces. The option -b/--bind specifies a specific address to which it should bind. docs
    ​

    Is there a way to disable IPv4? I asked it to bind to ::.

    Continue reading...

Compartilhe esta Página