I try to get the DemoWeb Liveview application running.
I have to go through a proxy and therefor need a url prefix, e.g.
https://myhost.de/foo/thermostat
I have set url: [host: “myhost.de”, path: “foo”, port: 443] in dev.exs
The http request have the ‘foo’ path and therefor are working (I can see the thermostat web page).
However the wss: requests fail since the browser tries to connect to wss://myhost.de/live/websocket?vsn=2.0.0,
i.e the path ‘foo’ is missing.
How can I set the path for wss requests ?
In myapp/lib/myapp_web/
there is an endpoint.ex
file which contains the definition of the socket. you will see in there something like this:
socket "/live", Phoenix.LiveView.Socket
That is where the path for the socket is set …
You will also need to change the path in assets/js/app.js
to point to the right place as well, e.g.:
let liveSocket = new LiveSocket("/foo/live")