CORS errors when hosting MathJax
August 16, 2019 08:41AM
I am trying to host MathJax on our location network (IP 10.0.x.y, no hostname) using the following nginx config:

server {
listen 80;
server_name _;

location ~* \.(ttf|ttc|otf|eot|woff|font.css)$ {
add_header "Access-Control-Allow-Origin" "*";
expires 1M;
add_header Cache-Control "public";
}

location /misc/ {

root /var/www/html/;
}
}

I am getting a lot

Access to font at 'http://10.0.x.y/misc/MathJax-2.7.5/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff?V=2.7.5' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
10.0.x.y/misc/MathJax-2.7.5/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff?V=2.7.5:1 GET http://10.0.x.y/misc/MathJax-2.7.5/fonts/HTML-CSS/TeX/woff/MathJax_Caligraphic-Regular.woff?V=2.7.5 net::ERR_FAILED

errors in chrome.

How to correctly allow access to these fonts?


P.S.: I am using nginx/1.10.3
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready