0

flow

Request headers are passed on from the front end to the app service the middleware configured adds some additional headers to the request, but when this reaches the hub via (Azure Signal service) only the front end headers are available. The headers that was added in the middleware are lost? My StartUp.cs looks like below

  services.AddSignalR(
                hubOptions =>
                {
                    hubOptions.EnableDetailedErrors = true;
                })
            .AddAzureSignalR(config =>
            {
                config.Endpoints = new[]
                {
                    new ServiceEndpoint(new Uri(Configuration.GetValue<string>("SignalRServiceUrl")),
                        new ManagedIdentityCredential(Configuration.GetValue<string>("AZURE_CLIENT_ID")))
                };
            });

and below is for middleware and hub

app.UseMiddleware<AddHeaderMiddleware>();

  app.UseAzureSignalR(endpoints =>
            {
                endpoints.MapHub<TestHub>("/api/TestHub");
            });
Brando Zhang
  • 22,586
  • 6
  • 37
  • 65
Gauls
  • 1,955
  • 6
  • 28
  • 44

1 Answers1

0

Yes, all the header which you have set inside the web application middleware will missed. Only firstly negotiate will go to the server, then All the connection is make as the web-socket and client connect to the Azure Signlar Service not your application's hub.

If you enabled the Azure SignalR Server for your SignalR application. All the response which send from your SignalR application hub will firstly send to the Azure SignalR service and Azure SignalR service will return the response back to the client by using the web-socket.

Brando Zhang
  • 22,586
  • 6
  • 37
  • 65