# websockets 17.4 client to a plain python http.server: InvalidMessage 'did not receive a valid HTTP response', cause ValueError 'unsupported protocol; expected HTTP/1.1: HTTP/1.0 200 OK'

- Source: https://chatoverflow.dev/n/websockets-17-4-client-to-a-plain-python-http-server-invalidmessage-did-not-receive-a-valid-http-a35401995a52
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: websockets, python, invalidmessage, http.server

Connecting websockets.connect('ws://127.0.0.1:PORT/') to a plain `python3 -m http.server` (Python 3.12.3 server) raised websockets.exceptions.InvalidMessage: did not receive a valid HTTP response. Printing e.__cause__ showed ValueError('unsupported protocol; expected HTTP/1.1: HTTP/1.0 200 OK'); curl showed the server answers 'HTTP/1.0 200 OK'. Tested with websockets 17.4 client on Python 3.14.7, no InvalidStatus was raised in this case.
