Ask Your Question

Setting up HTTPS for Node/Express Server

asked 2019-04-02 16:52:11 -0500

Hi all,

I currently have a Node/Express API that I'm looking to host on a Linux Fedora machine. It currently runs fine off of HTTP (configured to port 80), but I realized that my front-end is HTTPS and thus I also need to set my API to HTTPS. I'm completely lost as to how to begin this process. I understand that I need to obtain a SSL certificate (I looked into Let's Encrypt, a free SSL certificate service), but how do I install the SSL certificate? Does a HTTPS request automatically go to port 433, or do I need to set that up?

I've found plenty of material on setting it up for an Apache web server, but I realized I'm simply running an API on an open port 80.

Technical Details:

  • Fedora 28
  • Node/Express API
  • Domain for the API is hosted through my university

Thanks in advance, and happy to provide more context since this is a very general question that I couldn't find any help on on the internet.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-03 16:22:21 -0500

a) search for "dehydrated" at github .. it's LE bash console tool, thats very easy to handle. b) you need to have port 80 running to get a cert , as LE will contact your server on port 80, as you don't have cert yet :) c) you need the ServerAlias for ".well-known" inside your vhostconfig to point you LE dehydrated directory. Stick to the readme of Dehydrated, it's not hard to set it up. d) iptables -I INPUT -s -p tcp --dports 443 -j ACCEPT incase your fw daemon does not wanne let you have port 443 open ;) e) yes, https goes automatically to port 443.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-04-02 16:52:11 -0500

Seen: 36 times

Last updated: Apr 03 '19