fix cors error in angular, react, ionic , web apps - firebase storage | google cloud storage

preview_player
Показать описание
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.
Рекомендации по теме
Комментарии
Автор

Great, i was searching for hours a fix. This saved my day. Thanks ❤

mohamedtoure
Автор

Bro you are a life saver 😅 try to download image again and again but it give me cors error but after watch your video🎉 it works

infinitecodes
Автор

Thank you so much. Before watching your video, I spent many hours trying to solve the problem

vicennzoRuyBarb
Автор

Thank you very much. I am using flutter and I also encountered the CORS error. Now it works fine! You can also add flutter in the title

aristoncatipay
Автор

OMG you solution can fix it! i stuck with cors firebase storage for 2 days. you're save my life! Thank you so much bro. God bless you.

AkarinSangyor
Автор

Thank you very much! You helped a lot of people solving this issue. Congrats!

gorkagarcia
Автор

thanks man, still works last i checked

badasstrapbass
Автор

This worked and save me hours of debugging

sinazobogicevic
Автор

Finally got someone who's straight forward

WaqarAhmad-qzmv
Автор

the best video that solve this problem ❤❤❤❤❤❤❤❤

play-good
Автор

thanks a lot bro you saved me big time i will mention you in speech one day thanks a lot again bro much appreciated

kwamemushi
Автор

Thank you so much man 🙏🙏🙏. After struggling 2 days .

naturelover
Автор

Thanks so much! that was the only video I found super helpful! keep it up

leezakdev
Автор

Thats cool, i was really wondering about this. Subscribed, keep it up bro

yuvarajyuvi
Автор

Thanks bro you make my day . very helpful

elihuchitrit
Автор

I was searching for two days, you save my project

jimuelbaraero
Автор

Awesome video! Problem is solved! Thank you!

ericgriffin
Автор

Helped me just now. This method works. Thanks bud.

georgegrafe
Автор

Muito brabo!
Te considero muito irmão, salvou aí 🤙

LucasFerreira-jmie
Автор

Thanks, bro, Finally I got result of my 6 days of effort.

MrxAmjad