403 forbidden for AWS Beanstalk Flask static files without SSL 403 forbidden for AWS Beanstalk Flask static files without SSL flask flask

403 forbidden for AWS Beanstalk Flask static files without SSL


I think I found the problem. I was inspecting by EB SSH just to understand what was going on and I noticed that the "ec2-user" I got logged in the AWS machine could access (running cd command) till the directory

/opt/python/current/app

but ec2-user wasn't allow to access dir

/opt/python/current/app/flaskApp

because of permissions.

While the static dirs and files contained in flaskApp yet had permissions set on 755, I noticed that flaskApp dir (which contains static dir) was 744 (that I thought would be fine). So I changed flaskApp dir permissions to 755 and it worked: now static files get loaded!

By the way I doubt this permissions set is good for production. The alternative could be to structure dirs so that static isn't a subdirectory of flaskApp dir, allowing this way to keep static dir set on 755 while having flaskApp dir set on more conservative permissions.


The owner/group being root may be irrelevant if the files aren't viewable by all users. Make sure they're accessible to all by running a chmod 664 on all the static files.