Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get header AUTHORIZATION but change to AUTHORIZATIO can get value

In Micro Framework.

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

When call $app->request->getHeader("AUTHORIZATION"); get null.

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

But $app->request->getHeader("AUTHORIZATIO"); can get value. How to fix it.

like image 604
Eakkapat Pattarathamrong Avatar asked Dec 20 '22 09:12

Eakkapat Pattarathamrong


1 Answers

It's Apache problem. I'm fix by add

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

near top of .htaccess

like image 173
Eakkapat Pattarathamrong Avatar answered Jan 05 '23 06:01

Eakkapat Pattarathamrong