Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Create advanced CORS middleware for specific CORS policy support #2072

Closed
DamianEdwards opened this Issue · 7 comments

4 participants

@DamianEdwards

Create OWIN middleware that uses the new Web API CORS support (System.Web.Cors) so that users requiring more advanced CORS support, including locking down origin domains to specific values, can do so.

@davidfowl davidfowl was assigned
@davidfowl
Owner

Gonna do this for 2.0 rc

@signalrcoreteam
Collaborator
app.MapConnection<RawConnection>("/raw-connection",
    new ConnnectionConfiguration { EnableCrossDomain = true });



app.Map("/raw-connection", map =>
    map.UseCors(CorsOptions.AllowAll)
       .UseConnection<RawConnection>()
);



public void Configuration(IAppBuilder app)
{
    app.Map("/raw-connection", ConfigureRawConnection);
    app.Map("/api", ConfigureWebApi);
    app.Map("/nancy", ConfigureNancy);
}

private void ConfigureRawConnection(IAppBuilder map)
{
    map.UseCors(CorsOptions.AllowAll);
    map.UseConnection<RawConnection>();
}
@Xiaohongt Xiaohongt was assigned
@Xiaohongt
Collaborator

Do we want to remove ConnectionConfiguration in SignalR.Core? ConnectionConfiguration seems become not necessary now.

@davidfowl
Owner

No, we want to be future proof incase we add any new configuration options in the future.

@Xiaohongt
Collaborator

When not UseCors in Owin Cors middleware, but now corss-origin can work if use jsonp

@davidfowl
Owner

Jsonp is separate from this issue. We're going to disable JSONP by default by adding a new flag. We had to do some research beforing coming to this decision but that has nothing to do with this issue.

@Xiaohongt
Collaborator

verified cross-origin for hub connection and persistent connection with all transports

@Xiaohongt Xiaohongt closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.