fix(docker): healthcheck WebSocket probe for Phoenix/Bandit#2167
Open
davidyuk wants to merge 1 commit intoaeternity:masterfrom
Open
fix(docker): healthcheck WebSocket probe for Phoenix/Bandit#2167davidyuk wants to merge 1 commit intoaeternity:masterfrom
davidyuk wants to merge 1 commit intoaeternity:masterfrom
Conversation
- Send full WebSocket handshake (Connection: Upgrade, Sec-WebSocket-Key, Sec-WebSocket-Version) and expect 101 Switching Protocols. Phoenix/Bandit return 400 for incomplete handshakes (RFC-compliant) instead of 426 that Cowboy used to return. - Extract common WebSocket check into ws_check(). - Fix DEPRECATED_SWAGGER_RES condition to require "0" explicitly. - Use -sS -m 0.5 on curl for quiet run and timeout.
4d71ab3 to
ae70506
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Docker healthcheck WebSocket probes were failing: the server returns 400 Bad Request instead of 426 Upgrade Required.
Phoenix (with Bandit) changed behavior in phoenixframework/phoenix#5621: invalid or incomplete WebSocket handshakes now get 400 (RFC-compliant) instead of 426 (Cowboy’s previous behavior). The healthcheck was sending an incomplete handshake (no
Sec-WebSocket-Key,Connection: closeinstead ofUpgrade), so the server correctly responded with 400 and the check failed.Solution
ws_check()function.DEPRECATED_SWAGGER_REScondition to require"0"explicitly (was truthy check).-sS -m 0.5on curl for quiet output and a 1s timeout.Testing
Run the healthcheck against a running MDW container (e.g. started with docker-compose); both
/websocketand/v2/websocketshould pass when the WebSocket server is up.