apache - PHP not see Authorization header -


i have application use oatuth2, , recognized there problem authorization header. because in php script can't read header.
header sent correctly(firebug network):

accept          application/json, text/plain, */* accept-encoding gzip, deflate accept-language pl,en-us;q=0.7,en;q=0.3 authorization   bearer 3213826ad9147747f3927feca675e3aeee7d0306 cache-control   max-age=0 connection      keep-alive cookie          __utma=269300334.55671391.1445337979.1448456981.1453303397.4; __utmz=269300334.1453303397.4.3.utmcsr **strong text**=haynet.pl|utmccn=(referral)|utmcmd=referral|utmcct=/; _ga=ga1.2.55671391.1445337979; phpsessid=m3e64vsduq8vpacfhvnfka66k1; _gat=1 host            pze2.biuro.netivo.pl referer         http://pze2.biuro.netivo.pl/ user-agent      mozilla/5.0 (windows nt 10.0; wow64; rv:43.0) gecko/20100101 firefox/43.0 

but when i'm calling getallheaders() function or apache_request_headers() function don't see authorization header,(response print apache_request_headers()):

array(10) {   ["accept"]=>   string(33) "application/json, text/plain, */*"   ["accept-encoding"]=>   string(13) "gzip, deflate"   ["accept-language"]=>   string(23) "pl,en-us;q=0.7,en;q=0.3"   ["cache-control"]=>   string(9) "max-age=0"   ["connection"]=>   string(10) "keep-alive"   ["cookie"]=>   string(230) "__utma=269300334.55671391.1445337979.1448456981.1453303397.4; __utmz=269300334.1453303397 .4.3.utmcsr=haynet.pl|utmccn=(referral)|utmcmd=referral|utmcct=/; _ga=ga1.2.55671391.1445337979; phpsessid =m3e64vsduq8vpacfhvnfka66k1; _gat=1"   ["host"]=>   string(20) "pze2.biuro.netivo.pl"   ["referer"]=>   string(28) "http://pze2.biuro.netivo.pl/"   ["user-agent"]=>   string(73) "mozilla/5.0 (windows nt 10.0; wow64; rv:43.0) gecko/20100101 firefox/43.0"   ["x-prerender-token"]=>   string(20) "rvnh5kfzvzm1hbrkqzdu" } 

dumping $_server var not see header too.

i tried adding directives in htacces, still does'nt work:

rewriteengine on rewritecond %{http:authorization} ^(.*) rewriterule .* - [e=http_authorization:%1] 

my entire htaccess file , apache vhost:

<ifmodule mod_headers.c>     requestheader set x-prerender-token "rvnh5kfzvzm1hbrkqzdu" </ifmodule>  <ifmodule mod_rewrite.c>      options -indexes     rewriteengine on      header add access-control-allow-origin: *     header add access-control-allow-methods: "get,post,options,delete,put"     header set access-control-allow-headers: "authorization"       # www => http     rewritecond %{http_host} ^www\.(.*)$ [nc]     rewriterule ^(.*)$ http://%1/$1 [r=301,l]      <ifmodule mod_proxy_http.c>         rewritecond %{http_user_agent} baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkshare|w3c_validator [nc,or]         rewritecond %{query_string} _escaped_fragment_          # proxy request prerender if it's request html         rewriterule ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent|\.ttf|\.woff))(.*) http://service.prerender.io/http://pze2.biuro.netivo.pl/$2 [p,l]     </ifmodule>      //some rewrite rules making app work  </ifmodule>  <virtualhost *:80>         servername pze2.biuro.netivo.pl         serveralias pze2.swmilib.pl         documentroot /var/www/pze2/          customlog /var/log/apache2/pze2_access.log combined         errorlog /var/log/apache2/pze2_error.log          <ifmodule log_forensic_module>                 forensiclog /var/log/apache2/pze_forensic.log         </ifmodule> </virtualhost> 

please help, have no idea why it's not working. mayby it's server problem. if tell me how fix it. have debian server apache2.2.22 , php 5.6.13

ok found answer. form solution, add htaccess:

setenvif authorization "(.*)" http_authorization=$1 

in case helped.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -