Password protect AWS Node EB application
amazon-elastic-beanstalk, amazon-web-services, node.js
Solution
Security groups will only block based on source IP, and htaccess is not supported by nginx. Instead they support configuration like this:
server {
...
auth_basic "closed website";
auth_basic_user_file conf/htpasswd;
}
But to achieve this you'll need to use elastic beanstalk's `.ebextensions` to modify the default nginx configuration. It's not easy at all.
The fastest way for you is probably to support HTTP auth within your node app itself. There are many guides to this, but here is one: http://www.sitepoint.com/http-authentication-in-node-js/
Problem
I've got a Node Elastic Beanstalk app up and running (though ELB). Right now it is just the AWS sample Node application on the server. Since this is a development server, before I can push my actual code up to the server I need to password protect the entire thing (this is to be used for client review, etc). I am having a ton of trouble trying to figure out how to do this. It seems that the application code is dropped in `/var/app/` and there's nothing in `/var/www/html/` (no hidden files) where I would normally setup an htaccess file. It's using nginx proxy, which I have never used, and I'm not exactly sure how the files are being served. What's the best way to lock this server down? Security groups? htaccess? Something else?