WebSocket exception
See original GitHub issueOcelot version: 19.0.2
Ocelot configuration, a route:
{
"UpstreamPathTemplate": "/JavaMessageService/websocket/{url}",
"UpstreamHttpMethod": [ "Get", "Post", "PUT", "DELETE", "OPTIONS" ],
"DownstreamPathTemplate": "/api/websocket/{url}",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [{
"Host": "192.168.1.22",
"Port": 9082
}]
}
Direct Access to ws://192.168.1.22:9082/api/websocket/xxl
was successful. 👇
Ocelot UpstreamPathTemplate will report an error 👇
The error message of Ocelot pipeline is as follows:
System.ArgumentException: Only Uris starting with 'ws://' or 'wss://' are supported. (Parameter 'uri')
at System.Net.WebSockets.ClientWebSocket.ConnectAsync(Uri uri, CancellationToken cancellationToken)
at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.Proxy(HttpContext context, String serverEndpoint)
at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.Invoke(HttpContext httpContext)
at Ocelot.DownstreamUrlCreator.Middleware.DownstreamUrlCreatorMiddleware.Invoke(HttpContext httpContext)
at Ocelot.LoadBalancer.Middleware.LoadBalancingMiddleware.Invoke(HttpContext httpContext)
at Ocelot.Request.Middleware.DownstreamRequestInitialiserMiddleware.Invoke(HttpContext httpContext)
at Ocelot.Multiplexer.MultiplexingMiddleware.Invoke(HttpContext httpContext)
at Ocelot.DownstreamRouteFinder.Middleware.DownstreamRouteFinderMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)
at Ocelot.Errors.Middleware.ExceptionHandlerMiddleware.Invoke(HttpContext httpContext)
Issue Analytics
- State:
- Created 2 months ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Exceptions - websockets 11.0.3 documentation
websockets.exceptions defines the following exception hierarchy: ... Raised to abort the handshake on purpose and return an HTTP response. This exception is an ......
Read more >How to use the websockets.exceptions. ...
To help you get started, we've selected a few websockets.exceptions.ConnectionClosedOK examples, based on popular ways it is used in public projects.
Read more >WebSocketException Class (System.Net.WebSockets)
Represents an exception that occurred when performing an operation on a WebSocket connection.
Read more >WebSocket: error event - Web APIs | MDN
The error event is fired when a connection with a WebSocket has been closed due to an error (some data couldn't be sent...
Read more >Python websockets error handling: growing number of ...
Unfortunately, my implementation leads to growing number of threads (one per error). What am I doing wrong here? import websockets import ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi raman! This is my solution
This is Nacos Config
This is the Gateway port
Direct Access to ws://192.168.1.22:9082/api/websocket/xxl was successful. An error is reported when accessing through the Gateway address (ws://192.168.1.22:4000/JavaMessage Service/websocket/xxl).The entire operation process has been uploaded. From the video, it can be seen that there is an exception when ocelot forwards websockets. Forwarding the HTTP protocol is normal. From the logs in the video, it can be seen that forwarding the HTTP protocol address:/JavaMessageService/note/ureadCount was successful

@zhaoyongjie183 commented on Aug 7:
Sorry, does that mean you have invalid definitions of the routes in ocelot.json? For example, if you have a duplicates of upstream templates (routes duplication) then you should have the following validation error in the logs:
$"{nameof(route)} {route.UpstreamPathTemplate} has duplicate"
. If you have some another validation error, you should have in logs a message like that;"Unable to start Ocelot, errors are: bla-bla-bla
. Could you confirm once again, that your issue is related to invalid configuration please? Can we close the issue?