AWS ElasticBeanstalk: JWT token not being validated after configuration change

Viewed 720

Using AWS console, I changed configuration setting of api key for a third-party service. Then all of a sudden, the following error is popping up on my live server.

{"detail":"Authentication credentials were not provided."}

It seems JWT token is not being validated(or passed). After hours of googling, I found that the error is caused by EB apache setting

Apparently, by setting,

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

in *.config, the problem should go away. I did exactly the same, with the code in wgsi_enabled_pass.config created within .ebextensions but it is still not working.

Please help the newbie pros! Thanks in advance!

2 Answers

Add this to a .ebextensions/customize_httpd.config file:

files:
  "/etc/httpd/conf.d/wsgi_custom.conf":
    mode: "000644"
    owner: root
    group: root
    content: |
      WSGIPassAuthorization On

This is more reliable then trying to concat to a conf file that may or may not exist.

@nbeuchat

If I rememeber correctly, try restarting the app from EBS console, or re-deploy the codes AFTER setting the container_commands in *.config as in the question. If this does not fix the problem, let me know. I'll look into what I did in the past to fix the bug.

Related