Error code 521 elastic beanstalk


I have bought a domain on godaddy. The Cloudflare name servers have been added to the godaddy domain. The website is running on an EC2 instance using Elastic BeanStalk.

This is working fine except for getting all traffic to route through https all the way through to terminating at the EC2 instance.

I have created an origin certificate on Cloudflare and setup a config file in ebextensions as specified in aws doco:

After turning on Full (strict) encryption mode in Cloudflare, I get the error code 521 and cannot see the website. Changing it back to Flexible mode fixes it.

As a side note I can’t access the godaddy Cpanel to upload the certificate. Not sure if that has anything to do with it. The godaddy cpanel button doesn’t exist…

Does anyone have any insight into this?


As the article, you already linked to, mentions that code means the server is not reachable. So it would seem as if your server is not properly configured. It will be best to pause Cloudflare

and make sure the site loads fine on HTTPS. Once it does, you can enable Cloudflare again.

I have paused Cloudflare and you are right the site does not load fine on HTTPS. I get “This site can’t be reached - refused to connect” error.

I am a noob when it comes to this stuff. Not sure what I am doing wrong. Do you have any guidance?

I am using codeigniter framework and I believe that is set up fine. I believe the elastic beanstalk environment is ok as well.

Unfortunately that’s a server issue. I would contact the host and clarify with them why the server is not properly configured.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.