2016-01-23 31 views
1

我有一个小型Flask应用程序,我想在AWS Elastic Beanstalk上运行。AWS Elastic Beanstalk:HTTP标题未出现在Flask应用程序中

应用程序部署并运行良好,但我注意到在request.headers中不存在自定义HTTP标头(HTTP_CUSTOM_TOKEN)。

我假设我从Apache配置中丢失了某些东西,但我对该环境不是很熟悉。

+1

解释请[编辑]包括一个[MCVE。 – davidism

回答

1

您需要启用WSGIPassAuthorization。如果您没有专门启用身份验证转发,apache将使用所需的标头,并且您的应用程序将不会收到它。

将此添加到.ebextensions文件夹中的* .config文件中。

commands: WSGIPassAuthorization: command: sed -i.bak '/WSGIScriptAlias/ a WSGIPassAuthorization On' config.py cwd: /opt/elasticbeanstalk/hooks

5

你需要的是类似于@Fartash建议的东西,只是略有不同。

添加.ebextensions/python.config

container_commands: 
    03wsgipass: 
    command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf' 

截至Using the AWS Elastic Beanstalk Python Platform

相关问题