February 11, 201610 yr Hi!I have some problem probably with one of my apache conf. files, but I'm not quite sure.I work as part of a team. We have a test server set up and a repo. I pull the files, start the work on my localhost.The site I am working on has several server aliases, like admin.puba.lh, m.puba.lh, and static.puba.lh. Of course the site is puba.lh. Admin is for the admin panel, m is for the mobile version, and static, is where the fonts are coming from, as far as I can see it. I do only the sitebuild part, not the php. My problem is, that FontAwesome is not showing on my localhost.I have checked the urls where the site is trying to pull the font files, when enter the url in the address bar it downloads the file, so that is ok. I have this error message in the browser, so I think the problem is with my server configuration: Font from origin 'http://static.puba.lh' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://m.puba.lh' is therefore not allowed access. I have virtual host set up in my httpd-vhosts.conf file: <VirtualHost *:80> DocumentRoot "C:\wamp\www\projects\puba\Web" ServerName puba.lh ServerAlias puba.lh ServerAlias m.puba.lh ServerAlias admin.puba.lh ServerAlias service.puba.lh ServerAlias static.puba.lh <Directory "C:\wamp\www\projects\puba"> Order allow,deny Allow from all </Directory> </VirtualHost> Does it have something to do with the Order allow, deny... part? Any help is appreciated, thank you!
February 11, 201610 yr It's a CORS issue, place this in the <VirtualHost> for your static content: <FilesMatch ".(eot|ttf|otf|woff)"> Header set Access-Control-Allow-Origin "*" </FilesMatch>
February 13, 201610 yr Author Hi!Thanks, I had a look at the .htacces file and saw this: <IfModule mod_headers.c> <FilesMatch "\.*$"> Header set Access-Control-Allow-Origin "*" </FilesMatch> </IfModule> mod_headers is enabled, but still no fontawesome and the error message is still there.
February 15, 201610 yr Author Yes, that helped a bit! I searched for cors (I did not know how it was called before ) and found several tutorials. I do not know why, but I had to put "always" in front of set. Header always set Access-Control-Allow-Origin "*" Finally the error message disappeared and I can see Fontawesome! Thank you!
Create an account or sign in to comment