Skip to content

Commit 7ffa983

Browse files
committed
For SSL in production
1 parent 4df9c31 commit 7ffa983

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: issuer-services/standalone.js

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ let Config = require('./config.json')
2020
Config.web3 = new Web3(Config.provider)
2121

2222
const app = express()
23+
if (process.env.NODE_ENV === 'production') {
24+
app.use((req, res, next) => {
25+
if (req.header('x-forwarded-proto') !== 'https') {
26+
res.redirect(`https://${req.header('host')}${req.url}`)
27+
} else {
28+
next()
29+
}
30+
})
31+
}
2332
app.use(serveStatic('public'))
2433
app.use(
2534
session({

0 commit comments

Comments
 (0)