Home Assistant reverse proxy through Lighttpd - (HTTP 400) Unexpected char in url schema

399 Views Asked by At

I am trying to set up a reverse proxy for HAOS using Lighttpd running on a different host. The following is my HA HTTP configuration:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.x.x/24 # A valid internal IP was provided

Lighttpd configuration:

$HTTP["url"] =~ "^/home-assistant" {
    url.rewrite-once = ( "^(/home-assistant)$" => "$1/" )
    proxy.server = ("" => (( "host" => "192.168.x.x", "port" => "8123")))
    proxy.header = ("map-urlpath" => ("/home-assistant" => ""), "upgrade" => "enable")
}

HTTP status code return from GET request: 400 (Bad Request)

Error displayed:

Unexpected char in url schema

Full error:

Logger: aiohttp.server
Source: /usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py:403

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 551, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.InvalidURLError: 400, message='Unexpected char in url schema'
0

There are 0 best solutions below