lovelylain / hass_ingress

Home Assistant ingress feature, add additional ingress panels to your Home Assistant frontend.
Apache License 2.0
31 stars 6 forks source link

Panel Item URL is not formed correctly, and headers don't seem to be sent #2

Closed zerocool2k closed 2 months ago

zerocool2k commented 3 months ago

I set up my HASS Configurator behind nginx from Swag, with basic http authentication. Everything is docker containers. Below is my ingress configuration:

ingress:
  configurator:
    title: HASS Configurator
    ingress: true
    toolbar: true
    icon: wrench
    url: https://subdomain2.mydomain.com
    headers:
      authorization: "Basic [base64 encoded username:password]"

When I click on the "HASS Configurator" menu on the side menu, it just show the default swag page ("Welcome to your SWAG instance...")

I checked browser console and found that the "Request URL" was "https://subdomain1.mydomain.com [which is my home assistant URL]" & "/api/ingress/" & "/configurator/" , instead of "https://subdomain2.mydomain.com" which it is supposed to be.

Also, I don't see the authorization headers being sent in the request headers at all. Is the configuration above correct if I want to send authorization headers for basic http auth?

lovelylain commented 3 months ago

Try add host header:

headers:
   host:
   authorization:
lovelylain commented 2 months ago

Close this issue as the author did not respond back.

zerocool2k commented 2 months ago

Sorry @lovelylain , I was away for a while. I did try adding "host: https://subdomain2.mydomain.com" to the headers but the "Request URL" was still formed incorrectly (as pointed out in the original post above). Any other suggestion?

lovelylain commented 2 months ago

host: subdomain2.mydomain.com

zerocool2k commented 2 months ago

Thanks @lovelylain , it works!

zerocool2k commented 2 months ago

@lovelylain I have a weird issue now though. I added another ingress for subdomain3.mydomain.com with the same config (with different domain and object name of course). However, only the other ingress works, the new one does not (it still displays the login prompt and it does not accept the login with correct user & pass which will work if I log in directly to subdomain3.mydomain.com). Any suggestion?

lovelylain commented 2 months ago

maybe not support ingress, use work_mode:iframe instead.

zerocool2k commented 2 months ago

Thanks. That works for web. However, on the mobile app, it still gives "401 Authorization" (no login popup). Any idea?

lovelylain commented 2 months ago

@zerocool2k use work_mode:auth with nginx.