可以使用 HTTP 请求来探测 Apache 设置中配置的 MIME 吗?
Possible to use HTTP request to probe MIME configured in Apache settings?
这个问题有点奇怪。鉴于我无权访问 Apache 服务器,我想检查 Apache Web 服务器是否使用正确的 MIME 类型来处理特定文件格式,例如 image/jpeg
用于 .jpg
文件。
由于 MIME 显示在 HTTP 响应中,例如:
accept-ranges:bytes
alt-svc:quic=":443"; ma=2592000; v="39,38,37,35"
cache-control:private, max-age=31536000
content-length:16786
content-type:image/jpeg <---
date:Mon, 21 Aug 2017 09:56:08 GMT
expires:Mon, 21 Aug 2017 09:56:08 GMT
last-modified:Wed, 14 Dec 2016 20:30:00 GMT
server:sffe
status:200
x-content-type-options:nosniff
x-xss-protection:1; mode=block
如果网络服务器配置不正确,例如添加:
AddHandler application/x-httpd-php .jpg
在.htaccess
或Apache配置文件中,我想使用HTTP请求来诊断。可能吗?当我从服务器请求 .jpg
时,Apache 服务器会以 application/x-httpd-php
响应吗?
您可以执行 curl -I http://yoursite.com/test.jpg
,这将为您提供 return 中的内容类型以及其他信息。
这个问题有点奇怪。鉴于我无权访问 Apache 服务器,我想检查 Apache Web 服务器是否使用正确的 MIME 类型来处理特定文件格式,例如 image/jpeg
用于 .jpg
文件。
由于 MIME 显示在 HTTP 响应中,例如:
accept-ranges:bytes
alt-svc:quic=":443"; ma=2592000; v="39,38,37,35"
cache-control:private, max-age=31536000
content-length:16786
content-type:image/jpeg <---
date:Mon, 21 Aug 2017 09:56:08 GMT
expires:Mon, 21 Aug 2017 09:56:08 GMT
last-modified:Wed, 14 Dec 2016 20:30:00 GMT
server:sffe
status:200
x-content-type-options:nosniff
x-xss-protection:1; mode=block
如果网络服务器配置不正确,例如添加:
AddHandler application/x-httpd-php .jpg
在.htaccess
或Apache配置文件中,我想使用HTTP请求来诊断。可能吗?当我从服务器请求 .jpg
时,Apache 服务器会以 application/x-httpd-php
响应吗?
您可以执行 curl -I http://yoursite.com/test.jpg
,这将为您提供 return 中的内容类型以及其他信息。