skip to Main Content

I have my .config files set up using the information available on aws and I have my load balancer listening on 443. My website is being served correctly via https when I connect using my elastic beanstalk url. Of course that url is not what my ssl certificate lists so there’s an error but none the less, it is displaying all the html and static files. Https seems to be working there.

When I attempt to visit my custom domain using http everything also displays correctly so my application seems fine, but when I attempt https using my custom domain nothing is loaded from my server. I just get the "Index of /" page. This is what I receive when my ALLOWED_HOSTS is incorrect so I assume it’s something super simple in my settings file that is blocking django from allowing apache to serve the content over https to my custom domain. Or else theres one other place I’m missing that needs me to register my domain with my load balancer? Is that a thing? I feel like I’ve been scouring the internet for help here so any suggestions are very much appreciated.

One other note is that I have all my static files being served via s3. That bucket actually does get loaded correctly when I visit my website’s custom url over https… Not sure if that’s a clue or just even more confusing.

Serving my static files via s3 lead me to omit the below as I wasn’t quite sure what to do with it….

  Alias /static/ /opt/python/current/app/static/

from the example listed here
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-python.html

Again, everything seems to be working via the https://[…]elasticbeantalk.com with an expected

ERR_CERT_COMMON_NAME_INVALID

Not sure why I’m getting "Index of /" when visiting my custom domain over https. Http works fine too.

2

Answers


  1. Chosen as BEST ANSWER

    I kind of figured it out in asking that question...

    No where in any tutorial had I read anything about creating a dns entry that aliased my load balancer to my domain name... This info solved it for me-

    https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-elb-load-balancer.html


  2. Check out this post about forcing HTTPS with django and elastic beanstalk. This solution only works if your elastic beanstalk environment has an application load balancer (as opposed to classic load balancer)

    https://medium.com/@Pibastte/how-to-setup-http-to-https-redirection-for-a-django-application-on-aws-elastic-beanstalk-and-have-de44cf05565

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search