Fix ssl
This commit is contained in:
parent
c54e5b9289
commit
76197018d6
3 changed files with 14 additions and 7 deletions
|
@ -1,9 +1,14 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const protocol = require("../utils/connection");
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', (req, res) => {
|
||||
res.render('index', {title: 'fake-log', domain: req.get('host')});
|
||||
res.render('index', {
|
||||
title: 'fake-log',
|
||||
proto: protocol(req),
|
||||
domain: req.get('host')
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
function getProtocol(req) {
|
||||
let proto = req.connection.encrypted || process.env.SSL === 'true' ? 'https' : 'http';
|
||||
console.log(`proto1: ${proto}`);
|
||||
// only do this if you trust the proxy
|
||||
proto = req.headers['x-forwarded-proto'] || proto;
|
||||
console.log(`proto2: ${proto}`);
|
||||
return proto.split(/\s*,\s*/)[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ block content
|
|||
p Welcome to #{title}!
|
||||
ul
|
||||
li
|
||||
a(href="http://api." + domain) api
|
||||
a(href=proto + "://api." + domain) api
|
||||
li
|
||||
a(href="http://cufs." + domain) cufs
|
||||
a(href=proto + "://cufs." + domain) cufs
|
||||
li
|
||||
a(href="http://uonetplus." + domain + "/Default/Start.mvc/Index") uonetplus
|
||||
a(href=proto + "://uonetplus." + domain + "/Default/Start.mvc/Index") uonetplus
|
||||
li
|
||||
a(href="http://uonetplus-uczen." + domain) uonetplus-uczen
|
||||
a(href=proto + "://uonetplus-uczen." + domain) uonetplus-uczen
|
||||
li
|
||||
a(href="http://uonetplus-opiekun." + domain + "/Default/123456") uonetplus-opiekun
|
||||
a(href=proto + "://uonetplus-opiekun." + domain + "/Default/123456") uonetplus-opiekun
|
||||
li
|
||||
a(href="http://uonetplus-uzytkownik." + domain) uonetplus-uzytkownik
|
||||
a(href=proto + "://uonetplus-uzytkownik." + domain) uonetplus-uzytkownik
|
||||
|
|
Loading…
Reference in a new issue