无法获取标头AUTHORIZATION但更改为AUTHORIZATION可以获取值

时间:2014-11-06 10:39:50

标签: http-headers phalcon jwt

在Micro Framework中。

curl -i -X GET -H "AUTHORIZATION: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJleHAiOjE0MTUyODg0NzgsImxhc3QiOjEzNTY5OTk1MjR9.-xysOSRcj5hgG1iMVfZWHuz39dEpvod0O5ry3EiBstg" http://localhost/contract/dist/api/v1/cue

致电$ app-> request-> getHeader(" AUTHORIZATION");得到null。

curl -i -X GET -H "AUTHORIZATIO: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJleHAiOjE0MTUyODg0NzgsImxhc3QiOjEzNTY5OTk1MjR9.-xysOSRcj5hgG1iMVfZWHuz39dEpvod0O5ry3EiBstg" http://localhost/contract/dist/api/v1/cue

但$ app-> request-> getHeader(" AUTHORIZATIO");可以获得价值。如何解决它。

1 个答案:

答案 0 :(得分:9)

这是Apache的问题。我通过添加

修复
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

靠近.htaccess

的顶部