SignalR: Add configurable transport settings for load-balanced deployments without sticky sessions#22700
Conversation
|
Claude finished @Migaroez's task in 5m 19s —— View job PR ReviewTarget: Adds a
Critical
Important
Suggestions
Request ChangesThe missing obsolete constructor on |
AndyButland
left a comment
There was a problem hiding this comment.
Looks good @Migaroez. Have left a few suggestions for consideration. Once you've decided and/or acted on any or all of these, please let me know and I'll take it for local testing.
Co-authored-by: Andy Butland <abutland73@gmail.com>
… with protected constructor.
AndyButland
left a comment
There was a problem hiding this comment.
All looks good to me now @Migaroez and tests out as expected. I'm seeing the call to the /umbraco/serverEventHub/negotiate?negotiateVersion=1 endpoint only with the default configuration and not when it's configured to skip. In both cases a web socket connection is established.
Please can you create a docs PR to document this new configuration setting? It needs to be indexed from here and added to the SUMMARY.md file (given it's a new configuration section). Should be marked as pending to go live with the RC of 17.5, which is due 11th June.
Description
Adds a new
Umbraco:CMS:SignalRconfiguration section that allows restricting SignalR transport protocols and skipping the negotiate round-trip. This is required for load-balanced deployments without sticky sessions, where the negotiate request and subsequent WebSocket connection may land on different servers, causing connection failures.Problem
When Umbraco is deployed behind a load balancer without sticky sessions, SignalR's default behavior performs a negotiate HTTP request before upgrading to WebSockets. If the negotiate request hits server A but the WebSocket connection is routed to server B, the connection fails because the connection token is not shared between servers.
Solution
Backend:
SignalRSettingsconfiguration model (Umbraco.Core) with:ClientShouldSkipNegotiation— tells the client to skip the negotiate round-tripBackOfficeAreaRoutesandPreviewRoutesapply transport restrictions to all SignalR hub endpoints viaHttpConnectionDispatcherOptionsConfigurationServerControllerexposes the SignalR settings to the client via a newSignalRClientSettingsResponseModelStaticServiceProviderfallback (scheduled for removal in v19)Frontend:
UmbServerConnectionreads SignalR settings from the server configuration endpointUmbManagementApiServerEventContext(server events hub) andUmbPreviewContext(preview hub) apply transport andskipNegotiationoptions when building hub connectionsGenerated API types updated
Configuration example (
appsettings.json):{ "Umbraco": { "CMS": { "SignalR": { "ClientShouldSkipNegotiation": true } } } }Downstream packages (e.g., Umbraco Cloud) can also configure these settings via IConfigureOptions.
How to test