16

On the test server goapp serv it works, on the appengine itself it get overwritten by application/octet-stream.

How can I tell appengine to stop doing that?

Could not guess mimetype for home/fonts/FontAwesome.otf. Using application/octet-stream...

My config file:

application: test
version: 0
runtime: go
api_version: go1
threadsafe: true

handlers:
 - url: /home
   static_dir: home

 - url: /home/font/(.*\.woff)
   static_files: home/font/\1
   upload: home/font/(.*\.woff)
   http_headers:
    Content-Type: application/font-woff

 - url: /home/font/(.*\.svg)
   static_files: home/font/\1
   upload: home/font/(.*\.svg)
   http_headers:
    Content-Type: image/svg+xml

 - url: /home/font/(.*\.eot)
   static_files: home/font/\1
   upload: home/font/(.*\.eot)
   http_headers:
    Content-Type: application/vnd.ms-fontobject

 - url: /home/font/(.*\.ttf)
   static_files: home/font/\1
   upload: home/font/(.*\.ttf)
   http_headers:
    Content-Type: application/x-font-ttf

 - url: /home/font/(.*\.otf)
   static_files: home/font/\1
   upload: home/font/(.*\.otf)
   http_headers:
    Content-Type: application/x-font-otf

 - url: /favicon.ico
   static_files: home/favicon.ico
   upload: home/favicon.ico

 - url: /documentation
   static_dir: documentation

 - url: /.*
   script: _go_app

inbound_services:
 - warmup
Gert Cuykens
  • 6,845
  • 13
  • 50
  • 84

2 Answers2

25

I believe the reason it's working locally is that your system has the required mime type defined for the .otf extension in the /etc/mime.types or equivalent.

AppEngine probably doesn't have that. So you have to give it a hint about the correct MIME type. It looks like you're trying to do but, but you are using "http_headers". Try "mime_type" instead:

  - url: /home/font/(.*\.otf)
    static_files: home/font/\1
    upload: home/font/(.*\.otf)
    mime_type: application/x-font-otf

I hope that works for you. The documentation is at:

https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Static_file_handlers

Yves Junqueira
  • 755
  • 6
  • 18
3

It's also worth noting that generic rule should go last, like this:

handlers:
- url: /static/fonts/(.*\.otf)
  static_files: static/fonts/\1
  upload: static/fonts/(.*\.otf)
  mime_type: application/x-font-otf

- url: /static/fonts/(.*\.ttf)
  static_files: static/fonts/\1
  upload: static/fonts/(.*\.ttf)
  mime_type: application/x-font-ttf

- url: /static
  static_dir: static
thevasya
  • 106
  • 1
  • 4