n4c*_*500 5 http-headers flask
我有一个小型Flask应用程序,我想在AWS Elastic Beanstalk上运行.
应用程序部署并运行正常,但我注意到自定义HTTP标头(HTTP_CUSTOM_TOKEN)不存在request.headers.
我假设我错过了Apache配置中的某些内容,但对该环境不是很熟悉.
你需要的是类似于@Fartash所建议的东西,只是略有不同.
添加.ebextensions/python.config:
container_commands:
03wsgipass:
command: 'echo "WSGIPassAuthorization On" >> ../wsgi.conf'
Run Code Online (Sandbox Code Playgroud)
正如使用AWS Elastic Beanstalk Python平台所解释的那样
您需要启用 WSGIPassAuthorization。如果您没有专门启用身份验证转发,apache 将使用所需的标头,并且您的应用程序将不会收到它。
将其添加到 .ebextensions 文件夹中的 *.config 文件中。
commands:
WSGIPassAuthorization:
command: sed -i.bak '/WSGIScriptAlias/ a WSGIPassAuthorization On' config.py
cwd: /opt/elasticbeanstalk/hooks
| 归档时间: |
|
| 查看次数: |
1744 次 |
| 最近记录: |