Skip to content

React web socket not working when using Yarp resource on HTTPS profile #16

Description

@Kralizek

I have a AppHost that uses the Yarp resource, a React application for the frontend and some backend applications. If I use the HTTPS profile, the changes are not reflected automatically in the browser. Everything works fine when working with the HTTP profile.

image

Here is a screenshot of the resource view of my repro

image

Here is my AppHost Program.cs

using Aspirant.Hosting;

var builder = DistributedApplication.CreateBuilder(args);

var web = builder.AddNpmApp("web", "../../web")
    .WithHttpEndpoint(env: "PORT")
    .RunWithEnvironment("BROWSER", "none");

var isHttps = builder.Configuration["DOTNET_LAUNCH_PROFILE"] == "https";

builder.AddYarp("ingress")
    .WithEndpoint(scheme: isHttps ? "https": "http", port: 11400)
    .WithReference(web)
    .LoadFromConfiguration("ReverseProxy");

builder.Build().Run();

And appsettings.json

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning",
      "Aspire.Hosting.Dcp": "Warning"
    }
  },
  "ReverseProxy": {
    "Routes": {
      "web": {
        "ClusterId": "web",
        "Order": 1,
        "Match": {
          "Path": "{**catchall}"
        }
      }
    },
    "Clusters": {
      "web": {
        "Destinations": {
          "web": {
            "Address": "http://web"
          }
        }
      }
    }
  }
}

PS: I'm perfectly fine working on the HTTP profile. I'm reporting this because it could have effects somewhere else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions