无法猜测mimetype [英] Could not guess mimetype
问题描述
在测试服务器 goapp serv
上它可以工作,在appengine本身它会被application / octet-stream覆盖。
我该如何告诉appengine停止这样做?
无法为home / fonts / FontAwesome.otf猜测mimetype。使用application / octet-stream ...
我的配置文件:
<$ p应用程序:测试
版本:0
运行时:去
api_version:go1
线程安全:真
处理程序:
- url:/ home
static_dir:home
$ b $ - url:/home/font/(.*\.woff)
static_files:home / font / \ 1
上传:home / font /(.* \.woff)
http_headers:
Content-Type:application / font-woff
- url :/home/font/(.*\.svg)
static_files:home / font / \ 1
上传:home / font /(.* \.svg)
http_headers :
Content-Type:image / svg + xml
- url:/home/font/(.*\.eot)
static_files:home / font / \ 1
上传:home / font /(.* \.eot)
http_headers:
Content-Type:application / vnd.ms-fontobject
- url :/home/font/(.*\.ttf)
static_files:home / font / \ 1
上传:home / font /(.* \.ttf)
http_headers :
内容类型: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
$ b $ - url:/ favicon .ico
static_files:home / favicon.ico
上传:home / favicon.ico
$ b - url:/ documentation
static_dir:文档
- url:/.*
script:_go_app
inbound_services:
- warmup
$我相信它在本地工作的原因是您的系统具有为/etc/mime.types中的.otf扩展名定义的所需MIME类型或同等学历。
AppEngine可能没有这个功能。所以你必须给它一个关于正确的MIME类型的提示。它看起来像你试图做的,但你使用http_headers。请尝试使用mime_type:
- url:/home/font/(.*\.otf)
static_files:home / font / \ 1
upload:home / font /(.* \.otf)
mime_type:application / x-font-otf
我希望这对您有用。该文档位于:
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
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:
这篇关于无法猜测mimetype的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!