Skip to content

Derive websocket scheme from request scheme - #6153

Merged
BalusC merged 1 commit into
mainfrom
issue_6150
Nov 9, 2026
Merged

BalusC merged 1 commit into
mainfrom
issue_6150

Conversation

@BalusC

@BalusC BalusC commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

ExternalContextImpl.encodeWebsocketURL always returned a ws:// URL. A page served over https:// therefore got an insecure push URL, which the browser refuses to open. The ExternalContext.encodeWebsocketURL javadoc requires "the correct websocket scheme".

This PR replaces only the scheme of the URL built from the request, so https gives wss and http gives ws. This is the same logic as on the 4.0 branch. The two UrlBuilder constants which are no longer used are removed.

The new tests in ExternalContextImplTest cover the following: https and http, with and without port, uppercase scheme, IPv6 host, http elsewhere in the host or path, the configured websocket port, response encoding, malformed request URL and null URL.

The regression comes from 90103af (#5256) and is present in all 4.1 releases. 5.0 has the same code and follows by upmerge.

Closes #6150

🤖 Generated with Claude Opus 5.5

encodeWebsocketURL always returned ws://, so a page served over https
got an insecure push URL which the browser refuses to open. Restore
the scheme replacement so that https gives wss and http gives ws.

Regression from 90103af (#5256), present in all 4.1 releases.

Closes #6150

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BalusC BalusC added this to the 4.1.21 milestone Nov 9, 2026
@BalusC
BalusC merged commit 5937a96 into main Nov 9, 2026
2 checks passed
@BalusC
BalusC deleted the issue_6150 branch November 10, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.1: encodeWebsocketURL always returns ws://, also for https requests (regression from 4.0)

1 participant