Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

No 'Access-Control-Allow-Origin' header is present on the requested resource.

Featured Replies

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!

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>
  • 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.

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.