Anyone familiar with Microsoft.Owin.Cors.CorsMiddleware?
-
So, I've got an open question on so We're experiencing cors issues with signalR resources and I can't imagine that I'm the only one that has had to solve this problem. The "default", documented configuration settings for enabling cors with signalR are
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
}but CorsOptions.AllowAll configures wildcard Access-Control-Allow-Origin and you cannot specify a wildcard value AND use withCredentials. So I'm investigating what it would take to create a custom Microsoft.Owin.Cors.CorsMiddleware or create a different CorsOptions setting. Does anyone have an example that replaces
app.UseCors(CorsOptions.AllowAll)
with
app.UseCors("CorsOptions with a CorsPolicy that doesn't specify wildcard origins")
"I need build Skynet. Plz send code"
-
So, I've got an open question on so We're experiencing cors issues with signalR resources and I can't imagine that I'm the only one that has had to solve this problem. The "default", documented configuration settings for enabling cors with signalR are
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
}but CorsOptions.AllowAll configures wildcard Access-Control-Allow-Origin and you cannot specify a wildcard value AND use withCredentials. So I'm investigating what it would take to create a custom Microsoft.Owin.Cors.CorsMiddleware or create a different CorsOptions setting. Does anyone have an example that replaces
app.UseCors(CorsOptions.AllowAll)
with
app.UseCors("CorsOptions with a CorsPolicy that doesn't specify wildcard origins")
"I need build Skynet. Plz send code"
so...when the heck did nested object initializers become good form??? (Note that this seems to be the only way to interact with the Origins collection. Once the CorsOptions object is constructed, there is no direct access to the properties on the PolicyResolver)
CorsOptions cors = new CorsOptions
{
PolicyProvider = new CorsPolicyProvider
{
PolicyResolver = context =>
{
var policy = new CorsPolicy
{
AllowAnyOrigin = false,
AllowAnyHeader = true,
AllowAnyMethod = true,
SupportsCredentials = true
};policy.Origins.Add("http://localhost"); } } }; app.UseCors(cors);
"I need build Skynet. Plz send code"