Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Elastic Beanstalk: HTTP Header not appearing in Flask application

I have a small Flask application that I want to run on AWS Elastic Beanstalk.

The application deploys and runs fine but I've noticed that a custom HTTP Header (HTTP_CUSTOM_TOKEN) is not present in request.headers.

I'm assuming I'm missing something from the Apache configuration but am not very familiar with that environment.

like image 578
n4cer500 Avatar asked Jan 23 '16 22:01

n4cer500


2 Answers

What you need is something similar to what @Fartash suggested, just slightly different.

Add .ebextensions/python.config :

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

as explained at Using the AWS Elastic Beanstalk Python Platform

like image 60
Jakub Czaplicki Avatar answered Sep 20 '22 13:09

Jakub Czaplicki


Remove underscores from the header variables, example:-

header_var_val = "some value"
replace it with -- headervarval = "some value"

like image 32
Rishabh Jhalani Avatar answered Sep 19 '22 13:09

Rishabh Jhalani