filmov
tv
fix cors error in angular, react, ionic , web apps - firebase storage | google cloud storage
![preview_player](https://i.ytimg.com/vi/tvCIEsk4Uas/sddefault.jpg)
Показать описание
SUBSCRIBE
How to Solve CORS Error?
#angular
#react
#firebase
#ionicframework
#reactnative
create a cors JSON file and paste the below code
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
Please Subscribe 🙏🙏. -----
Firebase storage CORS fix for Web app hosted on Firebase hosting.
How do CORS work?
There are two types of CORS requests: simple and preflight. A simple request can be initiated directly. A preflight request must send a preliminary, "preflight" request to the server to get permission before the primary request can proceed. A request is pre-flighted if any of the following circumstances are true:
It uses methods other than GET, HEAD, or POST.
It uses the POST method with a Content-Type other than text/plain, application/x-www-form-urlencoded, or multipart/form-data.
It sets custom headers. For example, X-PINGOTHER.
The following process occurs when a browser makes a simple request to Cloud Storage:
Cloud Storage compares the HTTP method of the request and the value of the Origin header to the Methods and Origins information in the target bucket's CORS configuration to see if there are matches. If there are, Cloud Storage includes the Access-Control-Allow-Origin header in its response. The Access-Control-Allow-Origin header contains the value of the Origin header from the initial request.
The browser receives the response and checks to see if the Access-Control-Allow-Origin value matches the domain specified in the original request. If they do match, the request succeeds. If they don't match, or if the Access-Control-Allow-Origin header is not present in the response, the request fails.
A preflight request performs the following steps first. If it is successful, it then follows the same process as a simple request:
The browser sends an OPTIONS request containing the Requested Method and Requested Headers of the primary request.
Cloud Storage responds back with the values of the HTTP methods and headers allowed by the targeted resource. If any of the method or header values in the preflight request aren't in the set of methods and headers allowed by the targeted resource, the request fails, and the primary request isn't sent.
This is a simplified description of CORS.
How to Solve CORS Error?
#angular
#react
#firebase
#ionicframework
#reactnative
create a cors JSON file and paste the below code
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
Please Subscribe 🙏🙏. -----
Firebase storage CORS fix for Web app hosted on Firebase hosting.
How do CORS work?
There are two types of CORS requests: simple and preflight. A simple request can be initiated directly. A preflight request must send a preliminary, "preflight" request to the server to get permission before the primary request can proceed. A request is pre-flighted if any of the following circumstances are true:
It uses methods other than GET, HEAD, or POST.
It uses the POST method with a Content-Type other than text/plain, application/x-www-form-urlencoded, or multipart/form-data.
It sets custom headers. For example, X-PINGOTHER.
The following process occurs when a browser makes a simple request to Cloud Storage:
Cloud Storage compares the HTTP method of the request and the value of the Origin header to the Methods and Origins information in the target bucket's CORS configuration to see if there are matches. If there are, Cloud Storage includes the Access-Control-Allow-Origin header in its response. The Access-Control-Allow-Origin header contains the value of the Origin header from the initial request.
The browser receives the response and checks to see if the Access-Control-Allow-Origin value matches the domain specified in the original request. If they do match, the request succeeds. If they don't match, or if the Access-Control-Allow-Origin header is not present in the response, the request fails.
A preflight request performs the following steps first. If it is successful, it then follows the same process as a simple request:
The browser sends an OPTIONS request containing the Requested Method and Requested Headers of the primary request.
Cloud Storage responds back with the values of the HTTP methods and headers allowed by the targeted resource. If any of the method or header values in the preflight request aren't in the set of methods and headers allowed by the targeted resource, the request fails, and the primary request isn't sent.
This is a simplified description of CORS.
Комментарии