Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

divinulledivi's avatar

Laravel CORS and accessing an external endpoint

I am using Laravel as an api backend and Nuxt js for frontend. I installed fruitcake/laravel-cors package to manage CORS. Now I need to make a GET request to an external resource (https://noembed.com) and I am getting a CORS errors: CORS request external redirect not allowed CORS preflight response did not succeed CORS request did not succeed

My request:

this.$axios.get('http://noembed.com/embed?url=' + url).then(function(response) {
        console.log(response);
      }).catch(function(error) {
        console.log(error);
      });

Do I need to change something in my Cors config in Laravel? Or do I need to add headers to my axios request?

0 likes
3 replies
divinulledivi's avatar

No, noembed is an external API I want to use. In addition to this one, I will also be using Giphy API. Both of these throw a CORS error. But fetching data from my own API works just fine, the problem is only for other API's.

laracoft's avatar

@divinulledivi if it is an API, CORS errors won't happen. I cannot figure out from your posts who is throwing the CORS error.

You have to show the error in full showing clearly which website is trying to load from which other domain. Cut out all other unnecessary info such as your Laravel API and fruitcake. They have no role here since it is others API who are throwing the CORS.

Please or to participate in this conversation.