Encryption.....again

So I have been running Home Assistant for a while now and everything is great…except…I am almost crying out of despair trying to get encryption to work. I tried about 1 million times, new install etc… Here is what I have done now:

  • Install new HASS (using virtual machine, tried all the same things on the Raspberry though)
  • Login and create one user
  • Install the DuckDNS addon, following configuration
lets_encrypt:
  accept_terms: true
  certfile: fullchain.pem
  keyfile: privkey.pem
token: xxxxx
domains:
  - xxx.duckdns.org
aliases: []
seconds: 300
  • Installed Samba addon so I can modify the config when it doesn’t boot to the UI
  • Set up port forwarding (I tried all combinations of 443 and 8123, currently have 443 to 443 as this is what most guides explain. This has no effect at all on the below mentioned problem)
  • Started the DuckDNS addon and got the certificate files under /ssl
  • Then here is where it goes wrong and I cannot figure it out. According to all guides I went through, the next step is to add the “http” section to the configuration.yaml. So this now looks like this:
http:
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

Nothing else is in the config besides the default (remember, completely new and clean install)

Now if I add one or both of the lines to the config, HASS doesn’t allow me to use the Webinterface anymore. I can still access with Samba, but I cannot open the UI. Removing the lines from the config let’s it boot normally again, but well…encryption does not work.

I am now officially lost…tried everything and as stated a couple of times, started with a complete new and clean installation, added nothing besides what I described above…

Is there anything I am missing, or does anyone have a clue why it doesn’t start when I add the http lines?

Looks like mine.
But for the base_url in the config:

http:
  base_url: xxxxxx.duckdns.org
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

Have you openend your Router Port yet?

Base url hasn’t been an option in http in well over 6 months :roll_eyes:

@Remko , you will need those ssl lines, what errors are you getting?

Wait what :smiley:
It works for me like this?! xD

Why is that than?

Either:

  • you’re running a very old version of homeassistant
  • you’re ignoring the errors generated by your configuration
1 Like

I am running the latest version available and I do not get any errors, the log file is empty. As I described above, as soon as I add these lines to the config, it doesn’t boot to the UI. The configuration check is ok and…there is almost nothing in the config…

And yes, port is open…

EDIT…this is the first time I finally got some errors in the log… can anyone make any sense out of this?

2020-12-08 10:40:28 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2020-12-08 10:40:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2020-12-08 10:40:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2020-12-08 10:40:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2020-12-08 10:43:09 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2020-12-08 10:43:09 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2020-12-08 10:43:09 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"

If there are no errors and homeassistant is running, then the chances are that your homeassistant ui is running but you can’t access it.

Your port forwarding should be 443 to 8123 and your url should be https://your_domain.duckdns.org (note the s after http)

You can also try to access it locally by using https://192.168.1.200:8123 (again, note the s and obviously use your ip) - this will generate a security warning but it’s fine to proceed past.

If the latter works fine, but the former not, you may have an issue with loopback on your router.

Edit - now you’ve posted the error - confirmed that you’re trying to access with http not https…

aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
1 Like

YES!!! Finally…that is it… I thought I could locally still connect without the https…

Got it working…I now also understand the NGINX addon and why to use it. Even set that up and all of a sudden the world is perfect again. Oh what have I started with Home Assitant…it is such a slippery slope. I now found out I can also set it up as a full Homematic IP server…hmmm…

Thanks a million times…maybe tonight I can sleep again…:wink:

Running 0.118.5
I see no errors, where should I find those?

I looked in the HomeAssistant log file. That is where the errors were, which pointed me in the right direction and solved my issues

Simply running check configuration should tell you that you are using deprecated configuration.

Base url in http was replaced with internal url and external url (under homeassistant, but preferably set via the ui under configuration, general) a long time ago.

3 Likes

I changed it and am now restarting, let’s hope I did not break anything :wink:

Thanks man, missed those changes as well. Suddenly stopped working a few days ago. Now up & running again.

2 Likes