Home > Web Front-end > JS Tutorial > CORS Error: Why are \'requests only supported for protocol schemes: http...?\'

CORS Error: Why are \'requests only supported for protocol schemes: http...?\'

DDD
Release: 2024-12-03 03:03:09
Original
944 people have browsed it

CORS Error: Why are

CORS Error: "requests are 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/';
Copy after login

By correcting the URL to include the HTTP protocol scheme, the issue was resolved:

this._baseUrl = 'http://localhost:4201/';
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template