Not sure why your still getting an error maybe something with the server configuration.
I run all my cors stuff in my .htaccess file.
.htaccess:
Code:
# Add Font Types
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
# Add Image Types
AddType image/svg+xml .svg .svgz .jpg .png .ico
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg|svgz|jpg|png|ico|font.css|css|js)$">
#Header set Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Origin: "https://admin.local/"
Header add Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
Header add Access-Control-Allow-Headers: "Upgrade-Insecure-Requests"
</FilesMatch>
</IfModule>
That's how I do mine but I'm running apache sever.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )