[英]Apache doesn't see 'Authorization' header was sent via curl
I can't understand where the problem is. 我不明白问题出在哪里。 I send the request using curl like this:
我使用curl这样发送请求:
curl --header "Authorization: Bearer asd421123eda" https://server/example
One the server site just for debugging I use 我只用于调试的一个服务器站点
die("header: ".print_r(getallheaders()));
And I get the following(ips and hostname were changed by me) 我得到以下(我更改了ips和主机名)
Array
(
[Accept] => */*
[User-Agent] => curl/7.30.0
[Connection] => close
[X-Accel-Internal] => /examp
[X-Forwarded-For] => 19.13.131.123
[X-Real-Ip] => 131.41.132.141
[Host] => host.ht
)
And if I put some another header: 如果我放另一个头:
curl --header "Authorization1: Bearer" https://serverexample.com
I see this header in the headers array 我在headers数组中看到此header
Array
(
[Authorization1] => Bearer
[Accept] => */*
.....
)
It looks like for me that apache is filtering somewhere authoriztion header. 在我看来,Apache正在过滤某个授权标头。 Could you tell why it happens so, and how can I fix it.
你能告诉我为什么会这样吗,我该如何解决。 Thanks in advance
提前致谢
It seems you are running apache2 as FastCGI. 看来您正在将apache2作为FastCGI运行。 As FastCGI apache can not recognize
Authorization
header. 由于FastCGI apache无法识别
Authorization
标头。 You can use this rewrite rule as a work-around 您可以使用此重写规则作为解决方法
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.