
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Express middleware for forcing ssl. Redirects http requests to https. Tested on Express 4.x
npm install force-ssl
Prerequisites for this example:
npm install express self-signed-https force-ssl
Javascript code (paste into app.js):
var express = require('express')
var selfSignedHttps = require('self-signed-https')
var forceSsl = require('force-ssl')
var app = express()
app.listen(80) // http on port 80
selfSignedHttps(app).listen(443) // https on port 443
app.use(forceSsl)
app.get('/', function(req, res) {
res.send('hello world')
})
You may need to run it as root (since it listens on port 80):
sudo node app.js
Now if you visit http://localhost, it should redirect you to https://localhost
If HTTPS is running on a different port, then set the https_port option to specify it:
var express = require('express')
var selfSignedHttps = require('self-signed-https')
var forceSsl = require('force-ssl')
var app = express()
app.listen(3000) // http on port 3000
selfSignedHttps(app).listen(3001) // https on port 3001
forceSsl.https_port = 3001 // specify that https is running on port 3001
app.use(forceSsl)
app.get('/', function(req, res) {
res.send('hello world')
})
Now if you visit http://localhost:3000, it should redirect you to https://localhost:3001
MIT
FAQs
Express middleware for forcing ssl. Redirects http requests to https.
The npm package force-ssl receives a total of 16 weekly downloads. As such, force-ssl popularity was classified as not popular.
We found that force-ssl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.