I trying to make connection to server in React project but getting CORS error. What is the possible solution to this problem?
import { hubConnection } from 'signalr-no-jquery';
const connection = hubConnection('ip address');
const hubProxy = connection.createHubProxy('hubNameString');
connection.start({ jsonp: true })
.done(function(){ console.log('Now connected, connection ID=' + connection.id); })
.fail(function(){ console.log('Could not connect'); });
Console message:
Access to XMLHttpRequest at 'http://xxx' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.