abiosoft / caddy-docker

Docker container for Caddy
https://hub.docker.com/r/abiosoft/caddy/
MIT License
768 stars 315 forks source link

How to setup server to serve fonts #116

Closed ghost closed 6 years ago

ghost commented 6 years ago

caddy-docker is awesome,but I don't know how to setup to serve fonts. Here is apache and nginx CORS headers: https://github.com/fontello/fontello/wiki/How-to-setup-server-to-serve-fonts

abiosoft commented 6 years ago

This is not a caddy-docker specific issue, rather a general caddy usage question. Kindly limit the issues open here to bugs or questions specific to this docker image.

It is better to ask questions like this on https://caddy.community.

You can leverage mime directive for this.

mime {
  .ttc   application/x-font-ttf
  .ttf   application/x-font-ttf
  .otf   application/x-font-otf
  .woff  application/font-woff
  .woff2 application/font-woff2
  .eot   application/vnd.ms-fontobject
}

# leverage redir and header if you have fonts in other domain
header /fonts Access-Control-Allow-Origin  *
redir /fonts https://myfontdomain{uri} 
ghost commented 6 years ago

@abiosoft OK.Thanks anyway.