0
Sturla created
Hi
We are having problems connecting SignalR to the public MVC page and are getting the following error
We have successfully been using SignalR for our Blazor WASM backend (hosted as static website in Azure) so we know all about how SignalR should work (or we thought at least).
We have been trying all kinds versions of CORS settings in HttpApi.Host without luck
This didn´t do anything (now we are just using app.UseCors()
)
app.UseCors(x => x
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed(origin => true)
.AllowCredentials());
Is there a documentation or some other steps that we might be missing for for connecting with signalR in MVC public web app?
- ABP Framework version: 7.0.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated: yes
1 Answer(s)
-
0
You are using wildcard ('*') with
.AllowCredentials
. You need to whitelist the origins.You can configure CORS in publicwebdev app as:
context.Services.AddCors(options => { options.AddDefaultPolicy(builder => { builder .WithOrigins("https://eventstreamingapidev.azurewebsites.net") .WithAbpExposedHeaders() .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); });