Welcome Guest, Not a member yet? Register   Sign In
Access-Control-Allow-Origin / css font loading
#1

Hi !

I've got a problem with a font loading raisong Access-Control-Allow-Origin error.
The url of this font is specified in my css which is loaded correctly (except for the font).

Structure of my server :

Code:
/www
         /app
         /public
                /css
                /images
                /ressources
         /system
         /writable

In App.php, my $baseURL = "https://www.my_domain.com"
I've set up my mutu server in order to point to "./www/public" so that CI4 is working pretty fine.

But, I've got this "Access-Control-Allow-Origin" error disabling my css font loading when I try to access with "www.my_domain.com"
It's working fine with "www.my_domain.com/index.php" or with "https://www.my_domain.com"

All these auto/magic routes drives me crazy !!   Tongue
Reply
#2

Is your font being loaded from another domain? Maybe the URL of your font has a different protocol and that is misleading the headers and causing the browser's error.
Reply
#3

You can add this to your .htaccess file for fonts.

Code:
# Add Font Types
AddType application/vnd.ms-fontobject .eot
AddType font/truetype .ttf
AddType font/opentype .otf
AddType font/opentype .woff
AddType font/opentype .woff2
AddType image/svg+xml .svg .svgz

<FilesMatch ".(eot|ttf|otf|woff|woff2|svg|svgz|jpg)">
    Header set Access-Control-Allow-Origin "*"
</FilesMatch>
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

It's working like a charm !
Thanks a lot !
Reply




Theme © iAndrew 2016 - Forum software by © MyBB