Home  >  Article  >  Backend Development  >  How to Override the \"application/octet-stream\" MIME Type in App Engine?

How to Override the \"application/octet-stream\" MIME Type in App Engine?

DDD
DDDOriginal
2024-11-04 14:27:02186browse

How to Override the

Overriding Application/Octet-Stream Mimetype in App Engine

When hosting static files on App Engine, the platform may default to assigning the MIME type as "application/octet-stream" instead of the intended type. This can occur even if the configuration file appears to specify the correct MIME type.

To resolve this issue, utilize the "mime_type" parameter in the App Engine configuration file instead of "http_headers". Here's an example:

<code class="yaml">  - url: /home/font/(.*\.otf)
    static_files: home/font/
    upload: home/font/(.*\.otf)
    mime_type: application/x-font-otf</code>

This configuration ensures that files with an ".otf" extension are served with the correct "application/x-font-otf" MIME type, as intended.

The "http_headers" parameter is primarily used for setting HTTP headers unrelated to MIME types, such as "Cache-Control" or "Content-Disposition". By using "mime_type" specifically, it overrides the default behavior of "application/octet-stream" and forces App Engine to respect the MIME type specified in the configuration.

The above is the detailed content of How to Override the \"application/octet-stream\" MIME Type in App Engine?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn