Skip to content

Ocelot Load Balance using Web Socket Issue #1513

Open
@rycho27

Description

Hi Ocelot Team,

Please give advice for my current issue when using Load Balance configuration on Ocelot Gateway. My websocket implementation is for Microsof SignalR on my web client

## Expected Behavior / New Feature
When one of server is down, not causing error and able redirect request to connect websocket to another server

Actual Behavior / Motivation for New Feature

1 Backend Server down causing Bad Gateway request and unable to a connect websocket to another backend server
image

Steps to Reproduce the Problem

  1. Server A installed with 1 Backend service (using .net core 3.1) and Gateway (Ocelot) service
  2. Server B installed with 1 Backend service
  3. When All service running, client able to connect websocket using gateway
  4. When Backend service is turned off on Server A and backend in server B is running, client unable to connect websocket via gateway
  5. When Backend service is turned off on Server B and backend in server A is running, client unable to connect websocket via gateway
  6. Http request is running fine.

Specifications

  • Version: Ocelot 16.0.1
  • Platform: .net Core 3.1
  • Subsystem:
  • Please see my config on my ocelot.json
 {
    "Routes": [
        {
            "DownstreamPathTemplate": "/OPUIAPI/api/{everything}",
            "DownstreamScheme": "http",
            "DownstreamHostAndPorts": [
                {
                    "Host": "bthsa1163.infineon.com",
                    "Port": 8001
                },
                {
                    "Host": "bthtsa1030.infineon.com",
                    "Port": 8000
                }
            ],
            "UpstreamPathTemplate": "/gateway/opui/api/{everything}",
            "UpstreamHttpMethod": [
                "Get",
                "Put",
                "Post"
            ],
            "AuthenticationOptions": null,
            "FileCacheOptions": {
                "TtlSeconds": 0
            },
            "LoadBalancerOptions": {
                "Type": "LeastConnection"
            }
        },
        {
            "DownstreamPathTemplate": "/eqstatoui/api/{everything}",
            "DownstreamScheme": "http",
            "DownstreamHostAndPorts": [
                {
                    "Host": "bthsa1163.infineon.com",
                    "Port": 8000
                }
            ],
            "UpstreamPathTemplate": "/gateway/eqstat/api/{everything}",
            "UpstreamHttpMethod": [
                "Get",
                "Put",
                "Post"
            ],
            "AuthenticationOptions": null,
            "FileCacheOptions": {
                "TtlSeconds": 0
            },
            "LoadBalancerOptions": {
                "Type": "LeastConnection"
            }
        },
        {
            "DownstreamPathTemplate": "/eqstatoui/signalr",
            "DownstreamScheme": "ws",
            "DownstreamHostAndPorts": [
                {
                    "Host": "bthsa1163.infineon.com",
                    "Port": 8000
                }
            ],
            "UpstreamPathTemplate": "/gateway/eqstat/signalr",
            "UpstreamHttpMethod": [
                "Get",
                "Put",
                "Post",
                "Delete",
                "Options"
            ],
            "AuthenticationOptions": null,
            "FileCacheOptions": {
                "TtlSeconds": 0
            },
            "LoadBalancerOptions": {
                "Type": "LeastConnection"
            }
        },
        {
            "DownstreamPathTemplate": "/eqstatoui/signalr/{catchAll}",
            "DownstreamScheme": "ws",
            "DownstreamHostAndPorts": [
                {
                    "Host": "bthsa1163.infineon.com",
                    "Port": 8000
                }
            ],
            "UpstreamPathTemplate": "/gateway/eqstat/signalr/{catchAll}",
            "UpstreamHttpMethod": [
                "Get",
                "Put",
                "Post",
                "Delete",
                "Options"
            ],
            "AuthenticationOptions": null,
            "FileCacheOptions": {
                "TtlSeconds": 0
            },
            "LoadBalancerOptions": {
                "Type": "LeastConnection"
            }
        },
        {
            "DownstreamPathTemplate": "/OPUIAPI/signalr",
            "DownstreamScheme": "ws",
            "DownstreamHostAndPorts": [
                {
                    "Host": "bthsa1163.infineon.com",
                    "Port": 8001
                },
                {
                    "Host": "bthtsa1030.infineon.com",
                    "Port": 8000
                }
            ],
            "UpstreamPathTemplate": "/gateway/opui/signalr",
            "UpstreamHttpMethod": [
                "Get",
                "Put",
                "Post",
                "Delete",
                "Options"
            ],
            "AuthenticationOptions": null,
            "FileCacheOptions": {
                "TtlSeconds": 0
            },
            "LoadBalancerOptions": {
                "Type": "LeastConnection"
            }
        },
        {
            "DownstreamPathTemplate": "/OPUIAPI/signalr/{catchAll}",
            "DownstreamScheme": "ws",
            "DownstreamHostAndPorts": [
                {
                    "Host": "bthsa1163.infineon.com",
                    "Port": 8001
                },
                {
                    "Host": "bthtsa1030.infineon.com",
                    "Port": 8000
                }
            ],
            "UpstreamPathTemplate": "/gateway/opui/signalr/{catchAll}",
            "UpstreamHttpMethod": [
                "Get",
                "Put",
                "Post",
                "Delete",
                "Options"
            ],
            "AuthenticationOptions": null,
            "FileCacheOptions": {
                "TtlSeconds": 0
            },
            "LoadBalancerOptions": {
                "Type": "LeastConnection"
            }
        }
    ],
    "GlobalConfiguration": {
        "BaseUrl": "https://localhost:5011"
    }
}

Metadata

Assignees

No one assigned

    Labels

    Health CheckPOC Health ChecksLoad BalancerOcelot feature: Load BalanceracceptedBug or feature would be accepted as a PR or is being worked onbugIdentified as a potential bughelp wantedNot actively being worked on. If you plan to contribute, please drop a note.large effortLikely over a week of development effortmedium effortLikely a few days of development effortproposalProposal for a new functionality in Ocelot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions