Remix Framework — Setup HTTPS (SSL) on Localhost With Express Server | by Doğukan Akkaya | Mar, 2022

Let’s get began with making a contemporary Remix app.

npx create-remix@newest

Remix will ask you the title of your challenge, app sort, and deployment sort (server).

Select Categorical Server from the choices.

Firstly if you happen to don’t have a self-signed key and cert please create them first.

Set up openssl in your OS.

For macOS:

brew set up openssl

For Debian and Ubuntu:

sudo apt set up openssl

For CentOS and Fedora:

sudo yum set up openssl

Now create key and cert:

openssl req -newkey rsa:4096 
-x509
-sha256
-days 3650
-nodes
-out localhost.crt
-keyout localhost.key

Additionally, it is best to add your cert to trusted certificates:

sudo safety add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./localhost.crt

Your app now ought to comprise a file named server.js. Open the file and begin to edit it.

Simply import the createServer and readFileSync from the native https and fs module of Node.js.

Create an https object that comprises the important thing and cert. Then simply use createServer to create a Node Server and go the https object as the primary argument and the Categorical app because the second argument.

That’s it, simply go to https://127.0.0.1:3000 and also you’ll have a self-signed SSL in your localhost.

More Posts