fix(all): Minor changes in PROD.
This commit is contained in:
parent
f69b3f004c
commit
8a04ad2354
1 changed files with 7 additions and 9 deletions
16
src/app.ts
16
src/app.ts
|
@ -280,16 +280,14 @@ export class GBServer {
|
||||||
|
|
||||||
// Setups unsecure http redirect.
|
// Setups unsecure http redirect.
|
||||||
|
|
||||||
const httpServer = express();
|
const server1 = http.createServer((req,res)=>{
|
||||||
httpServer.use( (request, response, next) => {
|
|
||||||
if (request.headers.host != 'localhost' && !request.secure) {
|
res.writeHead(301, {
|
||||||
return response.redirect("https://" + request.headers.host + request.url);
|
Location: "https://" + req.headers.host + req.url
|
||||||
}
|
}).end();
|
||||||
next();
|
});
|
||||||
});
|
|
||||||
const httpDefaultPort = 80;
|
|
||||||
httpServer.listen(httpDefaultPort);
|
|
||||||
|
|
||||||
|
server1.listen(80);
|
||||||
|
|
||||||
if (process.env.CERTIFICATE_PFX) {
|
if (process.env.CERTIFICATE_PFX) {
|
||||||
const options1 = {
|
const options1 = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue