-
-
Notifications
You must be signed in to change notification settings - Fork 614
Error (No 'Access-Control-Allow-Origin' header is present on the requested resource.) #127
Comments
Same here |
@victor-ponamariov I've tried n ways and nothing solves this problem. |
Same problem. @victor-ponamariov |
@victor-ponamariov My App working! Because PHP ini bug:
Change php.ini to reslove this problem. This is not laravel-cors bug. |
@vitalibr |
Don't use Wamp I fixed this issue using Xampp instead. Hope this help |
I managed to fix this issue. I noticed my composer was using Updating my Solution: Update composer.json to:
|
I use |
Same here. I am able to GET/POST to normal routes though, but no luck with file upload (POST). |
Same here, but this error only appear when i try to use ng-resource |
My issue was solved by moving all (instead the laravel api only) servers to EDIT: not really solved... :( See comment below.
|
Solved! I have checked my laravel log, and there are some error from back-end. Although, the front-end show error "No 'Access-Control-Allow-Origin'..." Best Regards, |
@barryvdh et al, Ok, so I found out my issue was not really solved... Any clue on this one? I've updated to This use case regards a POST request using whatwg-fetch. The controller should invalidate the included file if it's not an image. Symptoms:
|
I have same problem using laravel 5.2, php 5.6 on windows x64. |
@goeroeku Did you set it to |
Did not solve the issue. I've tried adding this on top of
Any clue? |
@sandervanhooft variable always_populate_raw_post_data can't set with ini_set, you must set it on php.ini add phpinfo() on |
@goeroeku Just tried it (thanks!), but it seems deprecated in the PHP version I use (PHP7.0). So it does not pop up in the What PHP version are you using? Any other thoughts? |
All, Running I initially installed Downgraded to |
So 0.8.2 is broken, 0.8.1 works? |
@barryvdh I did not test |
Using with If try adding So, I've tried adding |
Using I get the error message:
It works on PHP 5.6, though. There is something wrong with PHP7, I can't find out what. Edit: ... Well, by removing laravel-cors entirely from my project and adding |
Same problem. Lumen5.3 + laravel-cors v0.8.2 |
i solved it.my lumen api cause a error.but there is no any error show in response. |
Same problem. :/ |
Getting the same error, Laravel 5.3.26 Laravel-cors 0.8.2 |
If someone override HandleCors class, you have to override Barryvdh\Cors\HandlePreflight also, because if you don't use HandleCors it skips OPTION request in HandlePreflight and returns nothing it why Access-Control-Allow-Origin is null |
I get the same error, it works on localhost but not when i deploy it to production. Getting
|
If you don't override HandleCors class, need to check any errors and also don't forget to add cors headers if exaction happens in an exception handler. |
Closing this as part of an issue-cleanup. Please re-open if this is still an issue on the latest version. |
I am struggling with this error from last 2 days. |
@Minhlong : Can you please share how you manage to resolve this ? |
Try the latest version |
I tired installing the latest version but its not supported with laravel 5.1 and I cann't update the version of laravel |
Yes it is. Otherwise please create a seperate issue. |
Laravel v5.4.15, cors v0.9.2. php 5.6.25. It Doesn't Work... |
I was using laravel 5.1, cors 0.7.x with angularjs 1.4 while getting this issue. But in the end it turns out that problem was due to completely different reasons. |
In the laravel logs there aren't error msgs. Laravel v5.4.15, cors v0.9.2. php 5.6.25. It Doesn't Work. : ( |
Please create a new issue with you exact configuration and steps you followed. And make sure you registered the Service Provider AND the middleware. |
I try to debug HandleCors, notice those OPTIONS / Pre-flight request doesn't hit the middleware. |
I had same problem with PHP 7 /laravel 5.4 put into index.php |
I had the same problem but solved it by set the cors in your api middleware like this
Hope this solved the problem And also, make sure all your endpoint should be group with api middleware.
Hope it help someone |
@gettosin4me not working for me, gave me this error
|
@ghprod use the code below, group the middleware with api
hope it works for u?? |
@gettosin4me nope, maybe its because i'm using together with Dingo API? The only way to make it works only by using it as global middleware .. |
|
Thanks @gettosin4me for your respond, really appreciate 👍 |
Same here, @gettosin4me solution did not work. Am on 5.4. |
Same here.i am on laravel5.4 dingapi laravel-cors 0.9 php7.0
api.php
cors middleware don't work. |
@allen-hxn For some reason I think the order matters in the array. Try: |
I'm facing the same issue atm in Laravel 5.4 using an Angular 2 frontend - you can find the whole story on stackoverflow: https://stackoverflow.com/questions/46991025/access-control-allow-origin-header-response-in-laravel-5-4-not-working-for-post @mycarrysun Apparently it's the same for 5.4 - it has to be
instead of
order appears to matter .. |
I had the same problem reported here and the solution was to change the order in the array that @mycarrysun mentioned. So I think the documentation should be updated to reflect this. Otherwise a lot of people will be shouting here for the same problem. Originally, the doc says:
It should be:
|
Great tutorial on Handling cors in Laravel 5.5 |
I was having the same error while uploading larger images. The error message on browser console was a bit misleading, it was showing After looking into nginx error log, I found out php was out of memory while processing the image using Intervention/Image So if it's |
Can you try my solutions, they are working for me (laravel 5.5) Solution 1. Init Cors middleware on global HTTP middleware in Route::options('{any?}', function (){
return response('',200);
})->where('any', '.*'); Guk luk! |
I was still getting a 500 error when trying to configure laravel-cors on Laravel 5.6. My solution... Don't do anything else... Adding it to the protected $middlewareGroups section was giving me 500 errors. |
thanks @goeroeku saved my day |
I was having a similar issue, but the cause was not this module, the cause was api controller route was returning an error 500, after solved the issue on the controller (on my case a misconfiguration of database connection settings) CORS error disappear. |
Hi all and @barryvdh,
I created an application in AngularJS and I'm trying to make calls to the Laravel API:
I use Laravel API Boilerplate (JWT Edition) to API.
But I get this error in the browser console:
I tried to apply the cors middleware (barryvdh/laravel-cors) in api_routes.php but the error remains.
api_routes.php:
My config/cors.php:
Error:
The text was updated successfully, but these errors were encountered: