I have an angular i18n application hosted on ngInix local server. The application is working as expected except loading the fonts.
Angular is always looking at the root folder of NgInix server to find the font files instead of looking at the asset folder in the locale folder. Here is my folder structure Folder structure
Here is my nginix.conf
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
map $http_accept_language $accept_language {
~*^en-US en-US;
~*^en-CA en-CA;
~*^en en;
}
server {
listen 80;
server_name localhost;
root html;
# Fallback to default language if no preference defined by browser
if ($accept_language ~ "^$") {
set $accept_language "en";
}
# Redirect "/" to Angular application in the preferred language of the browser
rewrite ^/$ /$accept_language permanent;
# Everything under the Angular application is always redirected to Angular in the
# correct language
location ~ ^/(en-CA|en-US|en) {
try_files $uri /$1/index.html?$args;
}
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
# ...
}
Error from console (https://i.stack.imgur.com/CTuAu.jpg)
I tried to rewrite the font request in the ngInix.conf file, but not worked. Any help appreciated.