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

andrade_dev's avatar

CORS with angular and laravel

Hi! i have a problem and i don´t know how to fix this, i need create a session with angular, but at the time of send mi credentials to the laravel app i see this en mi console javascript: 'XMLHttpRequest cannot load http://proflemsa.dev/api/v.0.1/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. ', please i need you help. Thanks so much

0 likes
4 replies
bagwaa's avatar
bagwaa
Best Answer
Level 12

Not sure I understand the question 100%, but you can just add in a header on the API :-

Access-Control-Allow-Origin: http://yoursite.com

or

Access-Control-Allow-Origin "*"

1 like
andrade_dev's avatar

Oh thank you very much, this is exactly what i needed, and im sorry mi english is not so good, but im learning. Thanks for everything

1 like
jgravois's avatar

How/where do you add -- Access-Control-Allow-Origin "*"

3 likes

Please or to participate in this conversation.