无法猜出mimetype

 H一直都在好麼 发布于 2023-02-12 14:02

在测试服务器上goapp serv它工作,在appengine本身它被application/octet-stream覆盖.

我如何告诉appengine停止这样做?

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

我的配置文件:

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

Yves Junquei.. 25

我相信它在本地工作的原因是你的系统具有为/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

我希望这对你有用.文档位于:

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

1 个回答
  • 我相信它在本地工作的原因是你的系统具有为/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
    

    我希望这对你有用.文档位于:

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

    2023-02-12 14:22 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有