Properly direct as https

This commit is contained in:
Deukhoofd 2016-05-23 15:51:04 +02:00
parent 27a571328b
commit 1b255c9f56
1 changed files with 4 additions and 1 deletions

View File

@ -54,7 +54,10 @@ exports.middleware = -> (req, res, next) ->
nonce = new Date().getTime() + '' + new Date().getMilliseconds(); nonce = new Date().getTime() + '' + new Date().getMilliseconds();
cookies.set("nonce", nonce) cookies.set("nonce", nonce)
console.log(req.headers.host) console.log(req.headers.host)
return_sso_url="http://" + req.headers.host + req.url if req.headers.host is "91.121.152.74:8000"
return_sso_url="http://" + req.headers.host + req.url
else
return_sso_url="https://" + req.headers.host + req.url
payload = "nonce=" + nonce + "&return_sso_url=" + return_sso_url payload = "nonce=" + nonce + "&return_sso_url=" + return_sso_url
base64payload = new Buffer(payload).toString('base64') base64payload = new Buffer(payload).toString('base64')
urlencoded = encodeURIComponent(base64payload) urlencoded = encodeURIComponent(base64payload)