mockserver
mockserver copied to clipboard
UI `_mockserver_ui_websocket` request returns 404 (request missing path prefix)
Describe the issue
With mock-server running behind a reverse-proxy setup (with a path prefix) the UI tries to establish a websocket to /_mockserver_ui_websocket
which results in a 404 (as it ignores the path prefix under which the service is exposed)
I imagine it is because the websocket URI seems hardocded to the root path and not a relative URI? https://github.com/mock-server/mockserver/blob/86c1ff8ae2ca32c044724e9f23c3ba329bc1c50d/mockserver-netty/src/main/java/org/mockserver/dashboard/DashboardWebSocketHandler.java#L60
https://github.com/mock-server/mockserver/blob/86c1ff8ae2ca32c044724e9f23c3ba329bc1c50d/mockserver-netty/src/main/java/org/mockserver/dashboard/DashboardWebSocketHandler.java#L152
What you are trying to do
Access the dashboard when running mock-server behind a reverse-proxy that exposes mock-server under a path prefix (e.g. /some/path/mockserver/dashboard
MockServer version 5.14.0
To Reproduce In our setup mock-server is running in k8s behind an nginx reverse proxy but I imagine any reverse proxy setup that includes a path prefix should repro the issue. The 404 can easily be seen by looking at the browser's devtools network tab when loading the UI
Expected behaviour
The websocket to be correctly established, namely the request to be done to /<path-prefix>/_mockserver_ui_websocket
I have same problem, would be great to have a fix for this.