Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Kralizek opened this issue Jun 19, 2024 · 2 comments
Open

Comments

@Kralizek
Copy link
Contributor

Kralizek commented Jun 19, 2024

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.

@Kralizek
Copy link
Contributor Author

Oh nice! Thanks!

The weird thing is that the web socket from the first screenshot uses a port that is not listed anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants