SignalK / signalk-server

An implementation of a Signal K central server for boats.
http://signalk.org
Apache License 2.0
298 stars 150 forks source link

No more the "/static/" directory? #1748

Closed VladimirKalachikhin closed 3 weeks ago

VladimirKalachikhin commented 3 weeks ago

Signal K Server version 2.8.2 The e-inkDashboard plugin has stopped working

GET
http://192.168.1.70:3531/static/dashboard.css
[HTTP/1.1 500 Internal Server Error 0ms]

... and other from /static/ directory.

tkurki commented 3 weeks ago

That has never worked.

VladimirKalachikhin commented 3 weeks ago

Ha! It's worked before 2.8.2 I say's: "e-inkDashboard plugin". The bug with zones was found with this plugin. The plugin worked with 2.8.1 The plugin has always used the /static/ directory, since 2021.

tkurki commented 3 weeks ago

SignalK Server's http server has never handled requests to /static/, so requests to that path have never worked. How could it even work for multiple plugins, if multiple plugins tried to use content from under a non-plugin specific path?

Apparently your plugin creates its own http server with default port 3531 as in the picture, so the problem is with your own code.

Creating your own http server is pretty stupid: it will not work at all in docker or behind a reverse proxy and your attempt to find out the server's external address only works in certain operating system.

Instead you could read the server's plugin documentation and find the documented way to create http endpoints and you could simply use relative or absolute-but-plugin-specific urls in your html.

I recently created a plugin/webapp that redirects from the static webapp html to the plugin's page with registerWithRouter handler.

VladimirKalachikhin commented 3 weeks ago

Thank you, Teppo, for reminding me how my plugin works. Even if you don't like the way it's made, I had my reasons for making it that way. Time has confirmed the correctness of my solutions. However, you were correct in stating that "so the problem is with your own code": in the JavaScript, not every correct code is always correct. Stricter coding restored functionality, and I'm no longer interested in what changed in version 2.8.2 that previously working code stopped working.