我注意到我的Elastic Beanstalk部署的Laravel 5.1 API和S3 Angular静态应用程序正在从我的请求中删除我的Auth Credentials。我的API正在使用https://github.com/lucadegasperi/oauth2-server-laravel代替OAuth2。
我关注this SO post on the issue,但似乎与 python 部署直接相关。
我的EB部署正在运行:
运行PHP 5.6的64位Amazon Linux 2015.09 v2.0.4
当我检查我的localhost请求时,我看到Access头文件存在:
http://dde-api.localhost/1.0/me/1/dashboard
请求:
响应:
在暂存时,它们被剥离:
请求:
响应:
http://dde.staging.com.s3-website-us-east-1.amazonaws.com/html/pages/dashboard.html
同样,我已经使用cURL
和DHC
发布到我的API以像往常一样获取令牌,然后向/dashboard
发出API请求,该请求在本地有效,但会抛出错误:
{“error”:“invalid_request”,“error_description”:“请求是 缺少必需参数,包含无效参数值, 不止一次包括一个参数,否则会出现格式错误。校验 “访问令牌”参数。“}
如何使用PHP解决此问题? WSGIPassAuthorization
是Python的东西吗?
答案 0 :(得分:1)
There is a bug in apache that strips the Authorization
headers as it feels it isn't needed.
I solved it by modifying my Apache access rules file, .htaccess
, (you can find this in your Laravel project), to check for this specific header, and make a copy of the header and pass it through:
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]