I am currently exploring the process of setting up a sails app that can handle both HTTP and HTTPS requests. To achieve this, I followed the steps outlined in the blog post available here:
var fs = require('fs');
module.exports = {
port: process.env.PORT || 1337,
environment: process.env.NODE_ENV || 'development',
express: { serverOptions : {
key: fs.readFileSync('ssl/key.pem'),
cert: fs.readFileSync('ssl/cert.pem')
}}
};
However, I encountered an issue where the configuration only allowed the server to respond to HTTPS requests. I am seeking advice or solutions from individuals who have successfully implemented a setup that caters to both HTTP and HTTPS without needing a separate HTTP-only server with redirects to port 443.
Any insights would be greatly appreciated.