当前位置:首页 » 《随便一记》 » 正文

unity webgl HTTP Response Header “Content-Type“ configured incorrectly on the server for file Build/

4 人参与  2024年10月30日 16:00  分类 : 《随便一记》  评论

点击全文阅读


官方说明

(1):WebAssembly 串流的服务器配置 - Unity 手册

(2):Unity - Manual: Server configuration code samples

下面以 nginx 部署为例

mime.types 配置文件添加 类型。

    application/wasm                                 wasm;

如图:

nginx.conf 配置文件 在http里面添加

include       mime.types; 

如图:

修改完成 重启nginx 服务,标头黄色警告就没有了。

Apache 只需添加文件到Build文件夹

 .htaccess

内容:

# This configuration file should be uploaded to the server as "<Application Folder>/Build/.htaccess"
# This configuration has been tested with Unity 2020.1 builds, hosted on Apache/2.4
# NOTE: "mod_mime" Apache module must be enabled for this configuration to work.

# The following lines are required for builds without decompression fallback, compressed with gzip


<IfModule mod_mime.c>

<FilesMatch "[^.]+\.data.gz$">
  Header set Content-Type "application/octet-stream"
  Header set Content-Encoding "gzip"
</FilesMatch>

<FilesMatch "[^.]+\.js.gz$">
  Header set Content-Type "application/javascript"
  Header set Content-Encoding "gzip"
</FilesMatch>

<FilesMatch "[^.]+\.wasm.gz$">
  Header set Content-Type "application/wasm"
  Header set Content-Encoding "gzip"
</FilesMatch>

<FilesMatch "[^.]+\.gz$">
  Header set Content-Encoding "gzip"
</FilesMatch>

<FilesMatch "[^.]+\.wasm$">
  # Header set Content-Encoding "gzip"
  Header set Content-Type "application/wasm"
</FilesMatch>

</IfModule>

IIS 配置


点击全文阅读


本文链接:http://zhangshiyu.com/post/180064.html

<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1