How do you enable tls(https)
unparagoned opened this issue · comments
Setting up allOrigins was simple and works great but how do I set up tls(https) with it? For reference I'm running it on an ec2 was instance.
Here is the code to add tsl
const https = require("https");
const fs = require("fs");
const app = require('./app.js')
const options = {
key: fs.readFileSync("./api.sdom.com.key"),
cert: fs.readFileSync("./api_sdom_com.crt"),
ca: fs.readFileSync('./api_sdom_com.ca-bundle')
};
const port = process.env.PORT || 80
console.log(`Starting allOrigins v${global.AO_VERSION}`)
app.listen(port, () => console.log('Listening on', port))
https.createServer(options, app).listen(443, ()=>console.log('listening on ', 443));
Can we merge this into main? @unparagoned
Edit: It's better to use let's encrypt on the whole server.
@red-saint-nft Do you have a link or guide to using let's encrypt on the whole server with this?