Single Instance Elastic Beanstalk Node App. HTTPS refused to connect - node.js

I have deployed a node.js app to Elastic Beanstalk. When I try to access the page via HTTP: everything works fine. when I try to access via HTTPS: I get a refused to connect error. I have followed the instructions on
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-nodejs.html
I created a .ebextensions folder and my https-instance-single.config looks like:
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
FromPort: 443
CidrIp: 0.0.0.0/0
I have uploaded and deployed the new zip file with these included and still the same thing. I can access via HTTP but not via HTTPS.
Any help would be greatly appreciated.

I would suggest you use LetsEncrypt for Elastic Beanstalk single instance. According to your current configuration, its only open port 443 to serve HTTPS but you are not pointing to certificate. This is the tutorial for LetsEncrypt SSL on Elastic Beanstalk:
https://www.tutcodex.com/ssl-on-single-instance-elastic-beanstalk-tutorial/

Related

Cannot get AWS Elastic Beanstalk single instance (no load balancer) to listen on 443

No matter what I do I cannot get my application to listen on port 443 (https). I simply need nginx to forward traffic to my app which is running https on port 8080, but nginx will only listen on port 80 and will refuse to forward to my app unless it is also running on port 80.
I've followed the instructions in this article but it makes no difference.
I do not have a domain name yet, I am simply using a self signed cert so I don't believe certbot will help here.
Please help I am so frustrated hahaaaaaa

Cant access nginx server through public ip

im learning deploy my net core app to linux vps, after install nginx and start, i cant access server through ip. Port 80 already opened. Everything seems right but nginx default page doesnt show.
Check Port:
Nginx Status:
nginx.conf
site-enabled/default

Application stops after configuring nginx (docker) for https

I have followed this tutorial for deploying docker containers on AWS EC2 instance:
https://www.digitalocean.com/community/tutorials/how-to-secure-a-containerized-node-js-application-with-nginx-let-s-encrypt-and-docker-compose
and after reaching step 5 (where nginx is configured for HTTPS), the application just stops working. Here's my application: www.alphadevop.co
Here’s my nginx configuration:
https://github.com/cyrilcabo/alphadevelopment/blob/master/nginx-conf/nginx.conf
And here’s my docker-compose.yml:
https://github.com/cyrilcabo/alphadevelopment/blob/master/docker-compose.yml
[Here's the webserver logs][1]
[1]: https://i.stack.imgur.com/oawtD.png
Silly mistake, port 443 wasn't allowed on my application. I was confused because when i checked on my server, port 443 was open. Then I checked here, https://www.yougetsignal.com/tools/open-ports/ , saying it was closed. I then found out that there's an inbound rule for AWS EC2 instance top allow port 443.
Credits here: NGINX SSL Timeout

http to https url in AWS Beanstalk single instance environment

I deployed my NodeJS/Express app on AWS Beanstalk. The current config is :
Environment type: single instance
EC2 instance type: t2.micro
Node.js version: 10.15.0
No load balancer
Proxy server : Nginx
When deployed it gives me a URL http://<app-name>.<server-location>.elasticbeanstalk.com/
I tested (using Postman) my authenticate API with the URL - http://<app-name>.<server-location>.elasticbeanstalk.com/users/authenticate and it gives me the status code of 200 OK and is working fine.
When I use HTTPS instead of HTTP it doesn't work as expected. In postman I get below error:
There was an error connecting to https://<app-name>.<server-location>.elasticbeanstalk.com/users/authenticate
I have my frontend deployed on netlify and when I trigger the same request from my Web application it gives me below error :
The page at 'https://<app-name>.netlify.com/login' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://<app-name>.<server-location>.elasticbeanstalk.com/users/authenticate'. This request has been blocked; the content must be served over HTTPS.
I understand that since my request is coming from https I need to have my backend configured to have https listener. I am not sure as to how I can accomplish this in AWS Beanstalk where I don't have a Load balancer and my env type is a single instance.
I am new to AWS. Appreciate your help. Thanks!
You'll need to add an .ebextension config file to:
Allow 443 traffic in your Security Group
Install the ssl package
copy the certificates from the application package to the ssl dir. (certificates can be created in the certificate manager) or paste them in the config file
edit nginx config
Here is an example
https://edwardsamuel.wordpress.com/2015/07/17/enable-https-and-http-redirect-on-aws-elastic-beanstalk/

Elastic Load Balance Config for Node.js and AWS EB

I am trying to deploy a Node.js Express server to AWS EB, but have some problem to config the proxy.
If I have no elasticloadbalancing.config file under the extension folder, then I can access to the server through HTTP and port 3000. However if I want to add a config to enable the HTTPS and proxy the listener port 433 to instance port 3000, then the site cannot be loaded.
Here is my Config file,
option_settings:
aws:elb:listener:443:
ListenerProtocol: HTTPS:
SSLCertificationeId: arn****
InstancePort: 3000
InstanceProtocol: HTTP
Could anyone give me any suggestions?
I am not sure if the EB is correctly configured, because once I deployed the config file, all ports in the Load Balancing in the web tier configuration were off. Will the EB use the loading balance automatically?
Here is the web tier config,
And here are listeners
Thanks.
You will need to specify config for opening the instance port access from the ELB.
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 3000
FromPort: 3000
SourceSecurityGroupName: {"Fn::GetAtt" : ["AWSEBLoadBalancer" , "SourceSecurityGroup.GroupName"]}
Please see the documentation available at
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-elb.html

Resources