前端:角度 后端:PHP 服务器:Apache
运行但我收到错误。 未捕获的SyntaxError:无效或意外的令牌bundle.js.gz:1
状态代码为200,标题类似于
接受编码:gzip,deflate,br
我想念什么?
答案 0 :(得分:0)
您要做的是提供预压缩的内容。 (bundle.js.gz) 将以下部分添加到您的site.conf中并重新加载。
<IfModule mod_headers.c>
# Serve gzip compressed CSS and JS files if they exist
# and the client accepts gzip.
RewriteCond "%{HTTP:Accept-encoding}" "gzip"
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
RewriteRule "^(.*)\.(css|js)" "$1\.$2\.gz" [QSA]
# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1]
RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
<FilesMatch "(\.js\.gz|\.css\.gz)$">
# Serve correct encoding type.
Header append Content-Encoding gzip
# Force proxies to cache gzipped &
# non-gzipped css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>