Elastic Beanstalk check.state

If you are using Elastic Beanstalk and are having issues with Username-Password-Authentication (Username Password auth). It might surface as check.state missing errors or you might get the error Cannot read properties of undefined (reading 'returnTo'). The issue might be ngnix’s config limits and it is dropping headers/auth0 cookies.

One manifestation of this is reaching an Nginx 502 page. If so, you can check by connecting to your EC2 box and checkout the /var/log/ngnix error.log file. You’ll probably see something along the lines of “Nginx upstream sent too big header while reading response header from upstream”.

You’ll need to update the Ngnix config buffers to allow for larger headers. You do this by adding these three lines to either the http, server, or location section:

 proxy_busy_buffers_size   512k;
 proxy_buffers   4 512k;
 proxy_buffer_size   256k;

It really depends on what your beanstalk setup is, so I can’t tell you specific instructions on how. I had to completely replace the ngnix.conf. I did it by connecting to my box and copying what was in several files and putting it into my single file. You can start by looking at the Reverse Proxy Configuration section here: Extending Elastic Beanstalk Linux platforms - AWS Elastic Beanstalk and then connect to your box and explore the /etc/ngnix config files on your box.

You can experiment with configs on your box if you connect to it. These commands will test a config and reload it so you don’t have to redploy every single time to test out a change.

nginx -t

nginx -s reload