From the course: Learning SignalR with ASP.NET Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

SignalR and CORS

SignalR and CORS

From the course: Learning SignalR with ASP.NET Core

Start my 1-month free trial

SignalR and CORS

- [Instructor] If server and clients are on separate domains you'll run into problems when browsers try to establish a connection. For example, if your signal R server is running on API.example.com but your browser clients are connecting from www.example.com you'll get errors when the clients try to connect. The reason is that browsers automatically block JavaScript code that tries to make a connection across domains. Your client running on a page on www.example.com won't be able to establish a connection to your signal R hub unless it's also running on www.example.com. The sample project in this course hosts the client and the server on the same domain so we won't run into this restriction. If your client and server are split up across domains you'll need to configure CORS or cross origin research sharing on your server. The ASP.net COR documentation covers CORS extensively. In this video I'll show you the minimum configuration you need for signal R. I'll open up the start up class…

Contents