nurikk / zigbee2mqtt-frontend

Zigbee2MQTT frontend
https://www.zigbee2mqtt.io/
GNU General Public License v3.0
263 stars 186 forks source link

[Bug]: Regression on 1.41.0 when running behind nginx reverse proxy #2223

Closed lkomurcu closed 2 weeks ago

lkomurcu commented 2 weeks ago

What happened?

I have been running zigbee2mqtt behind nginx reverse proxy with ssl under https://z2m.mydomain.com. All of my Home automation stack is running inside containers. After updating to 1.41.0 I was not able to access to zigbee2mqtt frontend via reverse proxy but I was able access it via ip/port. Chrome devtools console shows

index-6f55efcd.js:61 WebSocket connection to 'wss://z2m.mydomain.com/api' failed: 
(anonymous) @   index-6f55efcd.js:61 

I was able to bisect the latest changes commit where regression happens is coming from https://github.com/Koenkk/zigbee2mqtt/pull/24244 and commit https://github.com/Koenkk/zigbee2mqtt/pull/24244/commits/cbe08c32d0e4c4bace8ecf49390e7080fc1568ca

I reverted the line where a websocket server is created to not pass the new path parameter than regression seems to be fixed but the new feature is obviously would be broken.
this.wss = new WebSocket.Server({noServer: true, path: path.join(this.frontendBaseUrl, 'api')});

There is no stacktrace and state.json since from the application point of view everything is running perfectly fine.

I am not that good that typescript to be able to solve this issue. Hope we can restore this functionality back.

What browsers are you seeing the problem on?

Chrome

Relevant stacktrace

No response

Did you download state.json.zip?

I will not attach state.json.zip