-
-
Notifications
You must be signed in to change notification settings - Fork 616
No 'Access-Control-Allow-Origin' header is present on the requested resource. #481
Comments
In case it helps others #477 (comment). I'm using the 2.0 version on the server. |
How does your config look like? |
Looks like there is another solution too (at least for my use case) setting Thanks for the help @barryvdh. 🍻 |
same problem. in my case, /config/cors.php
/app/Http/Kernel.php
routes/web.php
sample.blade.php
it's working on local, but not working on lambda by vapor. |
same problem |
Same here, subbing to this thread. |
el mismo problema |
In my case, I solved it by adding header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS'); into routes/api.php check this link |
same problem |
Same problem. Just to mention I am using Laravel 8, maybe it has some breaking changes. |
Same problem in Laravel 8. |
Hello @celorodovalho |
The issue I had wasn't with this package or with Laravel. The issue was that I was stupid. Once I replaced this with Just mentioning here in case someone is making the same dummy mistake. |
@manoelsouzaunicef I had a stupid mistake. I was trying to debug using "dump" in some routes, so the OPTIONS can't handle the response throwing 'Access-Control-Allow-Origin' errors. |
I got it, brother. But my routes are just toJSON anyway. I'm stuck on that problem. It doesn't even work with @linaandres said. Not if it's related to the laravel version. Thanks a milion |
I solved this problem in Laravel 7 this way: in cors.php from: to |
I've had this problem occasionally, and it usually takes some time to debug. Today, I realized that my model Observer was failing and |
same problem in Laravel6 |
I noticed these errors when trying to do a very large upgrade. Version 5.3 for a bigger one. The solution was to remove the composer lock, the vendor folder, and redo the entire installation. Also remove caches with artisan cache: clear. |
Para quem ainda estiver com o problema, entrar no "DevTools" do navegador, aba Application e apertar o botão Clear site data. Isso resolveu pra mim. |
I still have this problem in laravelSanctum |
Every two months CORS is waiting for us in every new setup .. more than 13223298 developers commit suicide every year of f cors problems |
I am having problems with CORS after an upgrade of the Laravel version. Most cases aren't about a real error of CORS. When I active the mode environment to develop and active the logs with debug = true I can see the real errors in storage/logs. In most cases, the problems occurred with permission for storage/logs. |
Yeah sorry, it's really hard to debug these problems. I've tried to reproduce any of the cases on Github, but almost all are either misconfigured config (wrong path, old config cached), misconfigured permissions (eg. storage dir not writable), wrong usage (missing middleware), duplicatie headers (eg. nginx/apache/index.php also adding headers), headers already sent (echo/header calls), no proper response (dd()/exit() in the code or some proxy issue (wrong host). If there are actual reproducable errors on a clean Laravel install, I'm happy to take a look. |
Had the same problem, lol thank you very much |
Have you been able to fix this? I currently have this too |
@barryvdh - I am using this package and followed the documentation you provided. And it's working so far EXCEPT when I am trying perform a POST/PUT/PATCH request with file upload (binary) I am getting a CORS ERROR Note that this is not duplicate headers issue because it would throw me the error right when logging-in and I've created the nginx configuration myself. Hope you can enlighten me on this matter. |
As quick solution, you can modify headers in nginx or apache like following nginx (nginx.conf or valet.conf)
apache (.htaccess)
nginx config file
or if you are using valet
|
My problem with CORS where that I was accessing my host with HTTP and not HTTPS, on remote test server. |
Oh my god.... You made my day! |
hello guyz i found the solution. my configuration is exactly as the documentation says. but the problem was with the app cache. so i cleared cache and it worked command
|
For me it worked creating the middlewares and clearing the cache, thank you! |
Followed documentation, but having issue in laravel 9. |
im using this boilerplate Apiato
postman request working and browser request working but axios request not working.
axios setup.
error.
The text was updated successfully, but these errors were encountered: