ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.31k stars 1.63k forks source link

Using Signalr, web request 404 #2142

Closed MiaoShuYo closed 2 weeks ago

MiaoShuYo commented 3 weeks ago

I used Signalr in Ocelot and the web page showed a 404 Not Found when sending a connection request. My configuration looks like this:

{
    "UpstreamHttpMethod": [
        "GET",
        "POST",
        "PUT",
        "DELETE",
        "OPTIONS"
    ],
    "UpstreamPathTemplate": "/GatewayHub/{catchAll}",
    "DownstreamPathTemplate": "/{catchAll}",
    "DownstreamScheme": "ws",
    "DownstreamHostAndPorts": [
        {
            "Host": "127.0.0.1",
            "Port": 9933
        }
    ],
    "LoadBalancerOptions": {
        "Type": "RoundRobin"
    },
    "HttpHandlerOptions": {
        "UseProxy": true,
        "UseCookies": true,
        "AllowAutoRedirect": false
    }
}

企业微信截图_17242076711875 企业微信截图_17242077122408

Result of web page request:

1724207861814

1724207887863

Specifications

raman-m commented 3 weeks ago

Dear Miao, Thank you for your interest in Ocelot and for reporting the issue.

Regrettably, we cannot proceed with a description based solely on screenshots: it will be hard to reproduce the scenario. We would prefer if you could upload the complete solution to your account and share the link with us. This way, we can clone the repository, open it in Visual Studio, and run the application.

An ideal alternative would be to write an acceptance test that emulates the scenario and share the link to that branch.

P.S. Please attach Ocelot logs❗

raman-m commented 3 weeks ago
    "HttpHandlerOptions": {
        "UseCookies": true, // No such property!
    }

It should be UseCookieContainer, see UseCookieContainer

raman-m commented 3 weeks ago

var ocelotConfiguration = new OcelotPipelineConfiguration { ... } app.UseOcelot(ocelotConfiguration).Wait();

I'm curious about the settings within the configuration. These are critical settings because it appears you are overriding native Ocelot services. Could you show us what you are actually configuring?

raman-m commented 3 weeks ago

Version: 23.3.3 Platform: .NET 6

Why are you using .NET 6? Are you aware that it will reach the end of support in November 2024? Moreover, .NET 9 is set to be released, and .NET 6 will become deprecated. It would be wise to consider migrating to .NET 8.

raman-m commented 3 weeks ago

I used SignalR in Ocelot and the web page showed a 404 Not Found when sending a connection request.

Reviewing Ocelot logs is necessary!

raman-m commented 2 weeks ago

Dear author, where are you?

raman-m commented 2 weeks ago

Apologies, but we cannot proceed if there is no response from you, @MiaoShuYo.