3

I have a React front end making requests to my Discord.py bot running FastAPI. All is well on my testing environment, but when I deploy to my remote host uvicorn complains about

    WARNING:  Invalid HTTP request received.
Traceback (most recent call last):
  File "/home/container/uvicorn/protocols/http/h11_impl.py", line 136, in handle_events
    event = self.conn.next_event()
  File "/home/container/h11/_connection.py", line 443, in next_event
    exc._reraise_as_remote_protocol_error()
  File "/home/container/h11/_util.py", line 76, in _reraise_as_remote_protocol_error
    raise self
  File "/home/container/h11/_connection.py", line 425, in next_event
    event = self._extract_next_receive_event()
  File "/home/container/h11/_connection.py", line 367, in _extract_next_receive_event
    event = self._reader(self._receive_buffer)
  File "/home/container/h11/_readers.py", line 68, in maybe_read_from_IDLE_client
    raise LocalProtocolError("illegal request line")
h11._util.RemoteProtocolError: illegal request line
2022-01-15 22:59:11,310 - Invalid HTTP request received.
Traceback (most recent call last):
  File "/home/container/uvicorn/protocols/http/h11_impl.py", line 136, in handle_events
    event = self.conn.next_event()
  File "/home/container/h11/_connection.py", line 443, in next_event
    exc._reraise_as_remote_protocol_error()
  File "/home/container/h11/_util.py", line 76, in _reraise_as_remote_protocol_error
    raise self
  File "/home/container/h11/_connection.py", line 425, in next_event
    event = self._extract_next_receive_event()
  File "/home/container/h11/_connection.py", line 367, in _extract_next_receive_event
    event = self._reader(self._receive_buffer)
  File "/home/container/h11/_readers.py", line 68, in maybe_read_from_IDLE_client
    raise LocalProtocolError("illegal request line")
h11._util.RemoteProtocolError: illegal request line

Also, if I make the request via Postman, everything works just fine again. Is this an issue with my host, or with some uvicorn config I am missing?

NeatZ
  • 97
  • 1
  • 5

1 Answers1

7

change url from https to http when microservice does not support HTTPS

for ex: https://stackoverflow.com/a/66442651/10850556

Ali Gökkaya
  • 408
  • 6
  • 20