0

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?

Bryan Lumbantobing
  • 604
  • 1
  • 7
  • 22

2 Answers2

0

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

Niel
  • 66
  • 6
0

A solution i`m using to request insecure apis through Vercel is to use a lamda function to redirect my request. You create a lambda function https on AWS or Digital Ocean and make your Next requests to that function url.