Home >Web Front-end >JS Tutorial >CORS Error: Why are \'requests only supported for protocol schemes: http...?\'
When experiencing a CORS error like the one encountered in this scenario, it's important to verify that the protocol scheme used in the request URL matches one of the supported schemes (http, data, chrome, chrome-extension, or https).
In this case, the problem stemmed from the lack of a protocol scheme in the URL used in the Express backend code:
this._baseUrl = 'localhost:4201/';
By correcting the URL to include the HTTP protocol scheme, the issue was resolved:
this._baseUrl = 'http://localhost:4201/';
Therefore, it's crucial to ensure that the protocol scheme in the request URL corresponds to the expected value to avoid CORS errors.
The above is the detailed content of CORS Error: Why are \'requests only supported for protocol schemes: http...?\'. For more information, please follow other related articles on the PHP Chinese website!