客户端正在请求图像:
GET /api/2.0/users/80.png HTTP/1.1
Host: learnwithecho.com
Proxy-Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: image/* <------------------------------ HERE'S THE IMPORTANT PART
Accept-Language: en-us
Connection: keep-alive
User-Agent: Echo/1.0.16.1 CFNetwork/672.0.2 Darwin/12.5.0
我在 api/2.0/users.php 有一个脚本(是的,PATH_INFO 已打开)
...
header('Content-Type: image/png');
$user = User::getUserWithID($filename);
header("Location: ".$user->getImageURL());
exit(0);
但是 Apache 或 PHP 试图表现得好像它认识我……但事实并非如此。它假定 PHP 脚本不可能用图像/png 进行响应,并且它会引发406 Not Acceptable
错误。
我可以成功配置 Apache/PHP 来响应这个请求吗?