rwgamer
(Francesco Russo)
July 6, 2020, 6:25am
1
Good day,
want to insert home assistant in a sub path of a domain or ddns, can it be done?
I would like to use NGINX
example:
https://domain.io/homeassistant
https://domain.duckdns.org/homeassistant
hmoffatt
(Hamish Moffatt)
July 6, 2020, 6:29am
2
rwgamer
(Francesco Russo)
July 6, 2020, 6:37am
3
I think they should take this into consideration because it seems useful to me if not, you always have to specify the port or create a 3rd level domain or a second ddns if you want to expose more platforms
francisp
(Francis)
July 6, 2020, 6:43am
5
Yes, you can use nginx
You just have to use 3rd level domains, e.g. I have
rwgamer
(Francesco Russo)
July 6, 2020, 6:50am
6
I also have this configuration with a 3 level domain, but I would need to use a subpath
https://domains.io/homeassistant
hmoffatt
(Hamish Moffatt)
July 6, 2020, 6:56am
7
You can’t. Home Assistant doesn’t support it, as per the github issue I linked. It doesn’t matter what reverse proxy you use.
Use a subdomain.
rwgamer
(Francesco Russo)
July 6, 2020, 7:00am
8
for more sub-domains how networks are managed in italy would need more ddns clients and this is not possible for me
hmoffatt
(Hamish Moffatt)
July 6, 2020, 7:08am
9
I don’t understand. If you have a domain xyz.tld you can do anything you like with it.
Anyway what you ask is not possible so you have to find a domain solution.
francisp
(Francis)
July 6, 2020, 7:12am
10
I use cloudflare (free) and my subdomains are just c-names pointing to my main domain. So just 1 ddns client needed. And there is a nice add-on to manage. search for letsdnsocloud on the forum.
rwgamer
(Francesco Russo)
July 6, 2020, 7:20am
11
ok, but if you want to open more subdomains
example:
home.domain.io
nodered.domain.io
homeaasistant.domain.io
ecc…
networks are managed with dynamic ip and I can only manage via ddns that need a client to update the ip.
I have already tried this problem
rwgamer
(Francesco Russo)
July 6, 2020, 7:21am
12
thanks, i am using either duckdns or google domains
rwgamer
(Francesco Russo)
July 6, 2020, 7:23am
13
I opened a thread with a request to add this works, I hope they take it into consideration and that we can discuss the matter
Good morning, I would like to understand if there is the possibility to add the use of a subpath to the domain to use home assistant, could we add this function?
example:
https://domains.io/homeassistant
francisp
(Francis)
July 6, 2020, 7:23am
14
I’m sure google domains knows the concept of a c-name.
1 Like
rwgamer
(Francesco Russo)
July 6, 2020, 7:26am
15
yes, but I’m using the google domains ddns function and I don’t know if I can tell him to use only the same ip for more ddns, at least I haven’t found this function
hmoffatt
(Hamish Moffatt)
July 6, 2020, 7:56am
16
Use dns for one hostname in your domain. Add a cname for one or more other names to that first hostname. Problem solved.
rwgamer
(Francesco Russo)
July 6, 2020, 7:59am
17
in the end it will be what I will do if the function cannot be added
Jc2k
July 7, 2020, 7:16am
18
It was already decided by the team that this won’t be added:
opened 02:15AM - 24 Feb 19 UTC
closed 03:52AM - 19 Mar 19 UTC
As first discussed at https://github.com/home-assistant/home-assistant/issues/21… 113, Home Assistant doesn't currently support hosting on a path (eg `https://home.example.com/homeassistant`), being only able to be hosted at the root of a domain.
Being able to serving Home Assistant from a subdirectory would allow it to co-exist alongside several other applications on an existing single hostname (served by a web server or reverse proxy, like Nginx) . This would save maintaining a separate hostname for this one application, removing the need for additional firewall, DNS configuration or HTTPS certificate config/renewals and so on.
In other applications, serving an application on a path is common. It usually involves the app's resources being served with either absolute URLs (eg prefixed with a full `base_url` or just a path component), or via relative URLs (possibly with a `<base>` tag in the HTML). Dynamic apps often allow the frontend host to pass the "path" as part of the request (eg `PATH_INFO` in FastCGI), or otherwise applications might statically prefix all the resources on a page and it is up to the user to configure this correctly in the app's settings. I'm only generally familiar with Home Assistant's internals but given the [http `base_url` setting](https://www.home-assistant.io/components/http/#base_url) setting exists already, it appears to be following the latter "static" style of configuration.
To implement the ability for Home Assistant to be served with a path, the simplest solution appears to be a case of ensuring `base_url` affects Home Assistant's URLs correctly, where any assumptions have been made in the code about the app being hosted at the root (`/`) of the domain. For example, resources and links in the frontend HTML currently point at `/frontend_latest` and `/static`, so these would need the ability to be prefixed based on live configuration (or made relative). A comment on the previous issue mentioned there are other components [that rely on knowing the path exposed to the internet](https://github.com/home-assistant/home-assistant/issues/21113#issuecomment-464457085) so these would need adjusting too to make them flexible (& anywhere else that assumes the same).
Is Home Assistant's architecture able to accommodate being served on a path / is this something that can be done? I'm new to the project so happy to contribute a PR but I'd need some initial guidance from the core team to understand the scope and of changes required.
From a core dev (not naming so they don’t get spammed to hell, but you can see in ^ that ticket):
This will involve a LOT of work to both the backend and the frontend. And it will add work to each new feature/integration added, too. Or let alone the idea that a user would want to change the hosted path and all the config that now needs to be updated.
I don’t think it’s worth the effort to get there nor the effort to maintain it.