jansepke
jansepke

Reputation: 1979

Node.js sends empty font files

I try to mirror my public CDN server (Microsoft IIS) for local development with Node.js. I have this server:

var express = require('express');
var app = express();
app.use(express.static('../../resources'));
var server = app.listen(8282);

and request the glyphicons css file in my website, which loads a font file. but for some reason I got no data in chrome, regardless of the font type. everything is working fine on the public CDN.

enter image description here

Whats wrong with the node server?

Upvotes: 1

Views: 107

Answers (1)

jansepke
jansepke

Reputation: 1979

It is simple:

loading font files will go Cross-Origin so I need to set the Access-Control-Allow-Origin header:

res.setHeader('Access-Control-Allow-Origin', '*');

Upvotes: 1

Related Questions