Setting up AWS ElasticBeanStalk Environment for WSGI Authorization

Recently, I discussed an issue with JWT tokens not being recognized when deploying my API from a standard EC2 instance to a EBS instance.

Where I explained how you could manually modify the environment; now obviously this is not the proper way to handle this issue as with each new deployment you would need to login to the server and reconfigure Apache.

So in order to prevent this additional work here is how you would setup WSGI Authorization automagically with each deploy:

  1. In your virtualenv application path run the following

    1. $ mkdir .ebextensions

  2. Make a configuration file to be read on each deployment

    1. vim .ebextensions/wsgi_enabled_pass.config

  3. In this file you want to add the following snippet

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

This does what you expect it to do executing the command echo and appending the configuration to wsgi.conf file in your Apache home directory.

For more information on this please see:

Write a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.