- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
这是我尝试过的随机顺序的列表:
AddHandler application/x-httpd-php .otf
AddType
default_mimetype
auto_prepend_file = "otf.php"
zlib.output_compression = On
output_handler = ob_gzhandler
header("Content-type: application/octet-stream");
即使服务器的所有 PHP 文件都使用 zlib 压缩,将 .otf 扩展名替换为 .php 也不起作用。
最佳答案
使用 .htaccess,你可以这样做,假设字体文件是 fontfile.otf.gz
,浏览器请求它作为 fontfile.otf
RewriteEngine On
#Check for browser's Accept-Encoding, remove it for force return gzipped one
RewriteCond "%{HTTP:Accept-Encoding}" "gzip.*deflate|deflate.*gzip"
#check file name is endswith otf
RewriteCond %{REQUEST_FILENAME} "\.(otf)$"
#check existance of .gz file name
RewriteCond %{REQUEST_FILENAME}.gz -s
#rewrite it to .otf.gz
RewriteRule ^.*$ %{REQUEST_URI}.gz [L]
#update some response header
<FilesMatch "\.otf\.gz$">
AddEncoding gzip .gz
ForceType "text/plain"
</FilesMatch>
如果字体文件和网站是跨域的,你需要放Access-Control-Allow-Origin
,firefox不会加载font objects cross-domain .
In Gecko, web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP access controls are used to relax this restriction.
Header set Access-Control-Allow-Origin *
关于apache - 如何使用 .htaccess 提供 gziped 字体? (没有 mod gzip 或 deflate),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2042052/
我最近在此 Thoughtbot blog post 之后在我的 Rails 4 应用程序上启用了 GZIP我还添加了 use Rack::Deflater按照 this post 的建议添加到我的
我想知道 nginx 是否可以将 gzip 压缩的内容保存在缓存中,或者它一直 gzip 文件? 通过“保留缓存”,我的意思是内存或磁盘中的某些东西,在服务器端(没有浏览器缓存)。 因为我看到静态压缩
我试图让一段打开 http 连接的代码工作。然而,网页可以以纯文本或 gzip 格式传输。因此,具有实用主义的代码会尝试以纯文本形式打开,如果失败并接收到异常,则尝试使用 gzip 编码。 URL 是
我需要向 Web 服务器发送 POST 请求,并能够读取该服务器发送的响应。 我尝试使用带有以下代码的 HTTPBuilder 库: def http = new HTTPBuilder('http:
我的代码如下所示,但我无法成功获得响应。我的代码有什么问题吗? 代码: $headers = array('Content-Type: text/xml;charset=UTF-8','Content
我正在尝试做一个接受压缩响应的请求 var request = (HttpWebRequest)HttpWebRequest.Create(requestUri); request.Headers.A
这是我尝试过的随机顺序的列表: AddHandler application/x-httpd-php .otf AddType default_mimetype auto_prepend_file =
我启用了 Amazon CloudFront gzip 功能:“Compress Objects Automatically”。 我的 CloudFront 中的所有文件都会发生这种情况,而其他 CS
为什么 IE 10 和 11 无法加载 GZiped 内容(js 和 css)?当我从支持 gzip 压缩的服务器加载页面时,IE 加载第一个 HTML 页面但无法加载其他 js 和 css 文件。在
我是一名优秀的程序员,十分优秀!