1

I have a Node Express server running on an EC2 instance that listens for HTTP requests. I want to use an AWS Application Load Balancer to serve that content to the client browser through HTTPS while talking to my EC2 instance through HTTP (rather than make an HTTPS express server -- as recommended in the last EDIT TO ADD of this post)

Browser -- HTTPS Request --> AWS ELB -- HTTP Request --> EC2

How can I accomplish that? Tried to set a redirect to the EC2 instance but the console doesn't redirect from HTTPS -> HTTP

| improve this question | | | | |
  • What exactly doesn't work? Are you getting timeouts? Redirect issues? Something else? – MLu Apr 3 '19 at 21:58
  • I just can't redirect HTTPS port 443 to HTTP port 3000. At least not through a rule i.postimg.cc/vZJ13TZH/Screen-Shot-2019-04-03-at-6-26-18-PM.png – Neil Philip Apr 3 '19 at 22:27
  • 1
    you are not supposed to redirect. Redirect tells the browser that it should use a different URL to continue. In your case you need to configure the Target Group to talk to the backed on port 3000, that’s all. – MLu Apr 3 '19 at 22:41
  • ahh I see; forwarding is different from redirect. Is it possible to change target group configuration for an existing load balancer? Like can this be done by editting the listeners (it doesn't give me an option to change port for the Listener rules)... but it does in classic ELB – Neil Philip Apr 4 '19 at 3:02
0

Try the following setup:

  1. Create an Application Load Balancer with a Listener set to HTTPS listening on port 443.
    • Use availability zones that are public.
    • Use a certificate from ACM.
  2. Under "Configure Routing", create a target group with Target type "instance", Protocol HTTP, Port 3000. Make sure your health check path actually resolves on your instance.
  3. Under Register Targets, add your target instance but make sure to specify the port as 3000 and click the "Add to registered" button or it won't actually do anything.
  4. After creating the Application Load Balancer, create a DNS entry using a CNAME and Alias to "Yes" and specify your newly created Load Balancer.
  5. Once your DNS entry is created, test your new load balancer. If it fails, check the following.
    • Make sure the listener healthcheck is not failing. If it's failing, make sure your ec2 instance is allowing traffic from the load balancer in your security group.
| improve this answer | | | | |
  • thanks for the detailed help -- is it not possible to change target group configuration for an existing load balancer? – Neil Philip Apr 4 '19 at 3:00
  • Unfortunately no, you have to create a new target group to make any changes. Also, if the solution worked for you, can you please mark it as approved answer? – hal58th Apr 4 '19 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.