1
votes

I am running NodeJS app on EC2 instance on port 3000 without having any apache or nginx. I have setup ELB at front with SSL enabled( ACM on ELB ). Now I want to open my web-app url with https always.I have redirected port 443 request to port 3000 which is open on https. Same I want to do with port 80 request to go with 443 and then finally end up to port 3000, Because if someone request with port 80 for the web-app url that should also redirect to https and then end up on port 3000.

So Can you tell me How can I implement on ELB this thing for port 80 request which also open with https. My port 3000 is on http on EC2 instance.

port 443 https ----> port (3000) http ( its working )

port 80 (http) ---->want to open with https(443 ) ----->port(3000 ) http (this I want to implement)

2
You cannot force https using a AWS ELB you have to add that settings in to your web server.error2007s

2 Answers

3
votes

I'm afraid ELB doesn't have built in support for this feature. It's something your web app would need to deal with. You could set the ELB to forward port 80 to port 3000 too, and then in your app you'd need to inspect the X-Forwarded-Proto header; if this is not https then you would issue a redirect to port 443.

Amazon's X-Forwarded Docs

-1
votes

for solution to this, we need to run something on port 80 that could be sample nodeJS app or any default web-page(html or php) and then redirect port 80 request to port 443 and port 443 will redirect to port 3000(setup inside aws ELB) which is running actual NodeJS app.