Codeigniter CORS policy: No 'Access-Control-Allow-Origin' error How to resolve?
Allowing cross-site scripting may cause security issues, try to adjust your codeigniter options;
- Go to
application/config/config.php
file, - find
$config['base_url'] = "";
and place your project folder's path as value.
$config['base_url']="http://localhost/yourProjectFolder/";
Try allowing GET & OPTIONS
<?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: GET, OPTIONS");
If the above doesn't work, try allowing access to font resources via .htaccess
(for apache) or in nginx server block - add these lines:
# Apache config
<FilesMatch ".(eot|ttf|otf|woff)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
or
# nginx config
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
add_header Access-Control-Allow-Origin *;
}