Search code examples
nginxkubernetesannotationsmime-typesnginx-ingress

Nginx Kubernetes Ingress does not serve .ttf or .woff files


My Nginx Kubernetes ingress I think is not properly configured to serve .ttf file.

On safari work properly, but on chrome I have an error about cors allow. I checked my .conf Nginx file on my deployed ingress and "more_set_headers Access-Control-Allow-Origin: * is configured.

I think I need to add some annotations on mime.types or gzip config.

    apiVersion: networking.k8s.io/v1beta1
    kind: Ingress
    metadata:
      name: cc-i
      annotations:
        nginx.ingress.kubernetes.io/enable-cors: "true"
    spec:
      rules:
      - host: myapp.com
        http:
          paths:
          - backend:
              serviceName: cc-s
              servicePort: 80
      - http:
          paths:
          - backend:
              serviceName: cc-s
              servicePort: 80

Solution

  • Some CDN services has a cors configuration that need to be configured. In my case i added a cors authorized domain on my digitalocean space. This solved on firefox and chrome.