dfigus / addon-tvheadend

TVHeadend - Home Assistant Add-on
MIT License
3 stars 0 forks source link

Getting "403 Forbidden" after first setup #201

Open hcremer opened 2 weeks ago

hcremer commented 2 weeks ago

The Problem

I ran tvheadend on raspian light with a Pi-TV-Hat without problems. To avoid double power consumption, I now tried to integrate it int HomeAssistant. I installed the GauthamVarmaK's addon first, but after I found out that the hardware isn't discovered. When searching for a solution, I found out that this addon is outdated. So I uninstalled it, deleted the repository, installed the Daniel Figus repository and then the addon. In the first setup I gave an admin with password and a user with password. After finishing the first setup, I keep on getting "403 Forbidden" and can't log in to TVHeadend anymore.

Environment

Logs

2024-06-11 14:59:14.174 [ ERROR] http: 127.0.0.1: HTTP/1.1 GET (1) /api/hassio_ingress/eU7H1950nOft3aqcTxO5qP3FPD2C846SoEHIw4HcoGQ/extjs.html -- 403

Steps to reproduce

Click on "Open WEB UI" or sidebar first gives you a login window and then a "403 Forbidden" page

Additional Information

On a bare metal Raspberry with the latest RaspiOS TVHeadend works fine also with admin and user accounts configured.

hcremer commented 2 weeks ago

After looking into the closed issues, I saw that there was a similar problem in March. I tried to set up the whole server from scratch and avoided installing the GauthamVarmaK's addon first. The problem still persists. I can't log in after initial setup.

hcremer commented 1 week ago

Found out that I needed to put the allowed network to 0.0.0.0/0 instead of my home network. Now I'm able to log in, but next issue is: It doesn't show my Pi-TV-Hat in DVB-Inputs (on a native Raspbian this is shown)

dfigus commented 1 week ago

Hi, is the TV-Hat working on HA OS natively? That is usually the limiting factor, as HA OS does not ship with the required drivers and firmware. If it's not running on HA OS, there is nothing the addon can use.

dfigus commented 1 week ago

Found out that I needed to put the allowed network to 0.0.0.0/0 instead of my home network.

If you logon via the HA ingress (web ui button), it will go through HA and nginx reverse proxy and hence mask your real IP. TVH will then only see the HA internal IP as caller. There is a PROXY protocol & X-Forwarded-For config in TVH, which might help. But as HA OS will already do authentication, you might just want to allow 172.30.32.2 in addition to your local network and not everything via 0.0.0.0.

TVH is also directly accessible via HA-IP:9981 without the HA ingress and here TVH will see the correct caller IP. This direct access could be used from kodi for example.

hcremer commented 1 week ago

Hi, is the TV-Hat working on HA OS natively? That is usually the limiting factor, as HA OS does not ship with the required drivers and firmware. If it's not running on HA OS, there is nothing the addon can use.

Thank you very much for the quick reply! How can I check if it is working on HA OS natively. I installed SSH and did some tests. If I do a ls in /dev, I can't see something like /dev/dvb/adapter0

hcremer commented 1 week ago

Found out that I needed to put the allowed network to 0.0.0.0/0 instead of my home network.

If you logon via the HA ingress (web ui button), it will go through HA and nginx reverse proxy and hence mask your real IP. TVH will then only see the HA internal IP as caller. There is a PROXY protocol & X-Forwarded-For config in TVH, which might help. But as HA OS will already do authentication, you might just want to allow 172.30.32.2 in addition to your local network and not everything via 0.0.0.0.

TVH is also directly accessible via HA-IP:9981 without the HA ingress and here TVH will see the correct caller IP. This direct access could be used from kodi for example.

Thank you! This is very helpful. I'm totally new to HomeAssistant and didn't know about the 172.30.32.2 network address

dfigus commented 1 week ago

Thank you very much for the quick reply! How can I check if it is working on HA OS natively. I installed SSH and did some tests. If I do a ls in /dev, I can't see something like /dev/dvb/adapter0

You would need to ssh into the HA OS directly, see documentation here and check there. What is available here, can be used by the addon. Do you see anything in dmesg output regarding dvb?