简体   繁体   中英

How to change 'Access-Control-Allow-Origin' header?

Developing a small app using Firebase, Axios, VueJS. When I test on Firefox, a PUT request works as expected. When testing on latest version of Chrome, however, I get the following message:

Failed to load https://vuejs-stock-trader-XXXXX.firebaseio.com/data.json : Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value ' https://localhost:8080 ' that is not equal to the supplied origin. Origin ' http://localhost:8080 ' is therefore not allowed access.

My local server is indeed sending an http rather than an https request, but I'm a bit stumped as to why this would work in FF and not Chrome. Is there any way to find/modify the ACAO header? Or, any suggestions for why this might work in one browser and not another?

Chrome has some extra web security measures, if you open chrome with the option --disable-web-security it should work fine.

To solve this for Chrome with security enabled you will need to modify your server-side response headers and add Access-Control-Allow-Origin: * or replace the * with the url you will be accessing it from.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM