Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing slash on hass url breaks connectivity #999

Closed
nathan-march opened this issue Jul 1, 2020 · 12 comments
Closed

Trailing slash on hass url breaks connectivity #999

nathan-march opened this issue Jul 1, 2020 · 12 comments
Labels
bug Something isn't working

Comments

@nathan-march
Copy link

If you have a trailing slash on the end of the url, you'll just get this repeatedly:

WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds

Hass doesn't like the double slash and returns a 404:

GET //api/websocket HTTP/1.1
Upgrade: websocket
Host: 127.0.0.1:8123
Origin: http://127.0.0.1:8123
Sec-WebSocket-Key: 
Sec-WebSocket-Version: 13
Connection: upgrade

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=utf-8
Content-Length: 14
Date: Wed, 01 Jul 2020 05:05:09 GMT
Server: Python/3.7 aiohttp/3.6.1
@ReneTode
Copy link
Contributor

ReneTode commented Jul 1, 2020

where do you have the trailing slash?

if you mean ha_url in the plugin configuration then its only logical.

any invalid url will make that AD cant connect to HA.

@nathan-march
Copy link
Author

nathan-march commented Jul 1, 2020

Yeah in the ha_url. Agreed that it's incorrect, but appdaemon should throw a warning/error in my opinion if the url is malformed. It's easy to pick up a trailing slash if you copy + paste the url in from a browser.

The only part in the docs that you would pick up on this is if you look at the example for providing a secret. No other ha_url example or trailing slash is mentioned on https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html

@ReneTode
Copy link
Contributor

ReneTode commented Jul 1, 2020

AD expects a valid url.
that can be any url you want it to be, and AD cant check if you made a typo somewhere in the url.
it could be mentioned in the docs that in the most common cases there is no trailing slash.
feel free to make a PR to change the docs, so that its more obvious for everyone.
but keep in mind that the HA url can be something like:
http://xxx.xxx.xxx.xxx:xxxx
http://ha.something.com
https://anything.homeassistant.org:5121/some_folder

or any other url you can think of.

@Sh4d
Copy link

Sh4d commented Jul 1, 2020

A url containing a trailing slash, is a valid url. That appdaemon blindly adds on a "/api/websocket" path without checking first that the url doesn't already contain a trailing slash, means it creates a malformed url from the valid one provided by the user.

@ReneTode
Copy link
Contributor

ReneTode commented Jul 1, 2020

your right the docs for ha_url could be better.
because right now it also states that it needs to contain the portnumber, which isnt needed at all in some cases.

@nkuttler
Copy link

2.5 years and no fix? Imo this is not a documentation issue, this is a bug. Easy to fix, I can do it and strip trailing slashes if you like..

@ReneTode
Copy link
Contributor

no one is holding you back from making a PR.
i guess noone cared enough about it to do it in the past years.

@mion00
Copy link
Contributor

mion00 commented Mar 4, 2023

I would re-open this issue and file this under both "bug" and "enhancement", since as suggested AppDaemon should validate the config passed in by the user and warn it accordingly, guarding against this corner cases.

2.5 years and no fix? Imo this is not a documentation issue, this is a bug. Easy to fix, I can do it and strip trailing slashes if you like..

With this attitude I don't think you can go very far in the open source community. We are talking about a project developed and maintained (for free) by volunteers using their spare time. If as you suggest it is an easy fix, why don't you show a bit of respect to all the developers and contribute your fix in a pull request?

@nkuttler
Copy link

nkuttler commented Mar 4, 2023

I'm a volunteer in the open source community who is working full time and I didn't get around to fix something for free in three months that noone cared about in years and you start to insult me? Thank your for your remarks.

@acockburn
Copy link
Member

Which is why I closed this …

@mion00
Copy link
Contributor

mion00 commented Mar 4, 2023

(For context, I stumbled upon this thread by pure chance, notified by the project owner going through the backlog of issues, and I was quickly glancing at the whole thread).
I am not asking you for anything, since I understand we are all in the same boat as volunteers. Everyone is free to do whatever they please with their own time. Sorry if my previous sentence was misleading in that regard.
My point is about the way you started this conversation, which seemed quite rude:

2.5 years and no fix?

It seemed to me as if you were bothered by the fact that no one fixed this bug in a long time, as if the developers owed you. This to me sounded like lacking respect for the effort put behind the various volunteers on this project.

@acockburn acockburn reopened this Mar 4, 2023
@acockburn acockburn added the bug Something isn't working label Mar 4, 2023
@acockburn
Copy link
Member

Fixed in 4.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants