Home >Backend Development >Golang >Why Does App Engine Override MIME Type for .otf Files?
App Engine Overriding MIME Type for .otf Files
Despite manually specifying the MIME type for .otf files in the app.yaml configuration, App Engine persists in overriding it with application/octet-stream. Understanding the cause of this behavior and how to resolve it is crucial.
Cause of Overriding
On local machines, the .otf extension typically has the correct MIME type defined in system files like /etc/mime.types. However, App Engine lacks these system-wide definitions.
Solution: Explicitly Specify MIME Type
To address this issue, modify the mime_type field in the app.yaml configuration accordingly:
<code class="yaml">- url: /home/font/(.*\.otf) static_files: home/font/ upload: home/font/(.*\.otf) mime_type: application/x-font-otf</code>
By specifying the MIME type explicitly, App Engine will be instructed to use the appropriate content type when serving .otf files. This should resolve the problem.
Guidance
For more information on configuring MIME types in App Engine, refer to the official documentation at https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Static_file_handlers.
The above is the detailed content of Why Does App Engine Override MIME Type for .otf Files?. For more information, please follow other related articles on the PHP Chinese website!