dresden-elektronik / phoscon-app-beta

Access to Phoscon app beta
79 stars 5 forks source link

No access via reverse Proxy (nginx) #443

Closed boehser-enkel closed 2 years ago

boehser-enkel commented 2 years ago

Hey there,

i have problems to access the Phoscon webinterface over nginx Proxy Manager. (direct access is fine) When i access it over my hostname (routed through nginx) i get to the phoscon page but there is either:

How to route correctly?

greetz

tannyl commented 2 years ago

This might be related to the same problem in #215

I have been trying to fix a similar problem for the Ingress (more or less also an reverse proxy) solution in Home Assistant.

You may be able to get it to work by "helping" Phoscon App find the gateway, by using the sub_filter in Nginx. Take a look at the PR I made for the HA addon. https://github.com/home-assistant/addons/pull/2325

boehser-enkel commented 2 years ago

Thank you but i have no clue how i implement it with Nginx Rev Proxy config

tannyl commented 2 years ago

I tried installing Nginx Proxy Manager. You can add your own custom config (to some degree) via the GUI.

billede

Adding something like this (replacing the ip address of course)

location / {
  proxy_pass http://192.168.1.150/;
  proxy_redirect default;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection $http_connection;
  proxy_set_header Accept-Encoding "";
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header Host $http_host;
  proxy_set_header X-NginX-Proxy true;

  sub_filter_once off;
  sub_filter_types *;
  sub_filter ',-1!==document.location.hash.indexOf("nocache")' ',app.probeWorker.postMessage({add:[document.location.host]}),app.probeWorker.postMessage({scan:!0}),true';
}

I have not tested this against a Phoscon App, but did test that the "sub_filter" replacing worked as it should. So there might need to be set even more options to get the rest to work. Especially websockets. But give it a try and see how it goes. :)

stale[bot] commented 2 years ago

As there hasn't been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

stale[bot] commented 2 years ago

As there hasn't been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it isn't solved, request to get this opened again.