简体   繁体   中英

Send http request for api that not secure / not https in NEXTJS failed in production

I try to send a request to a public API that not host in https but it is hot in HTTP. Its all working good In localhost but when I deploy it to vercel production build in https url. it gives an error.

axios.get('http://api');

how to overcome this?

its possible, but understand the risks, take a look at also search for "jsonp" or "cors" ajax the following answer is for jQuery but i believe if you allow in header it should work. Jquery AJAX: No 'Access-Control-Allow-Origin' header is present on the requested resource

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