Reputation: 530
I have a website hosted with Parse.com. It runs on Node.js/Express.js 3. I am just trying to force https if somebody visits the domain with http. Possible?
They have some documentation, but I'm not sure how to apply it: https://parse.com/docs/js/symbols/parseExpressHttpsRedirect.html
Upvotes: 0
Views: 700
Reputation: 17960
It describes exactly how to use it on that page:
To use this middleware, you must require it from your JavaScript file:
var parseExpressHttpsRedirect = require('parse-express-https-redirect');
Then you can use the middleware to redirect all requests to HTTPS.
app.use(parseExpressHttpsRedirect());
So in code:
var parseExpressHttpsRedirect = require('parse-express-https-redirect');
// ... later on when you're initializing your express app ...
app.use(parseExpressHttpsRedirect());
Upvotes: 3