'use strict'
const express = require('express')
const session = require('express-session')
const helmet = require('helmet')
const bodyParser = require('body-parser')
const form = require('multer')()
const app = express()

const PassGen = require('./model/passgenerator.js')
const BlockChain = require('./model/BlockChain.js')

const Config = require('./config/Config.js')
const config = new Config()

app.use(helmet())
// app.use(helmet.referrerPolicy({ policy: 'same-origin' }))

app.use((res, req, next) => {
	if (req.secure || process.env.OPERATION_MODE === 'DEV') {
		next()
	} else{
		res.redirect("https://" + req.headers.host + req.url)
	}
})

app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.set('view engine', 'ejs')
app.use('/src', express.static('./views/src'))
app.use('/layout', express.static('./views/layout'))
app.use('/views', express.static('./views'))
app.set('port', (process.env.PORT || 5000))
app.use('/passgen', PassGen)
app.use('/blockchain', BlockChain)

app.get('/', function (req, res, next) {
  res.render('pages/index')
})

app.get('/newblock', function (req, res, next) {
  res.render('pages/createnewblock')
})

app.get('(error_page|*)' , function ( req , res , next) {
    res.status(404).render ('pages/error_page')
})

app.listen(app.get('port'), () => {
  console.log('Server is running at : ' + app.get('port'))
})

@@ -489,14 +489,14 @@
 ((re
-s
+q
 , re
-q
+s
 , ne
@@ -624,13 +624,16 @@
 ders
-.
+%5B%22
 host
+%22%5D
  + r

Fix HTTPS redirection