Reputation: 7022
I am working on a Laravel and Angular project. Project is running well in another Computer but I am getting below error in my Laptop.
I used this package. I tried several ways but could not find any solution.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource
My .htaccess
file is like below
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Could anyone help me in this regard ?
Upvotes: 5
Views: 13983
Reputation: 8709
You are only allowed to set the Access-Control-Allow-Origin
header once.
It seems this header is also set somewhere else than in the laravel-cors
package configuration. For example in your .htaccess
file, in your server configuration or (less likely since you get the exception only in one environment) in some other middleware you have created manually.
Upvotes: 2