workhorse: Return 400 from /cable without valid websocket upgrade
What does this MR do and why?
workhorse: Return 400 from /cable without valid websocket upgrade
Previously, a request to /cable without a valid websocket upgrade would return a 500 because wsRoute requires websocket headers to match the route. This results in a confusing error response and logs. Implement a new method wsRouteStrict that matches the route regardless of headers so an informative error can be returned.
References
Resolves #583200 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Compile & restart workhorse
- Navigate to a page that uses websockets (like the merge requests page)
- In your dev tools network tab, filter by
Socket, and verify that the connection successfully upgraded (status 101) -
curl -i http://localhost:3000/-/cablereturns a 400 withwebsocket upgrade required
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Fred Reinink