From 3699e0d14aaf8dd60155a24191077db4bccc67ee Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 9 Jun 2016 18:30:30 +0200 Subject: [PATCH] Fix homepage link behind AWS loadbalancer --- src/route/home.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/route/home.js b/src/route/home.js index d5415ae..65e9b89 100644 --- a/src/route/home.js +++ b/src/route/home.js @@ -1,8 +1,9 @@ 'use strict'; module.exports = function () { - let hkp = (this.secure ? 'hkps://' : 'hkp://') + this.host; - let del = this.origin + '/api/v1/removeKey?email=user@example.com'; + let tls = this.secure || process.env.NODE_ENV === 'production' && this.get('X-Forwarded-Proto') === 'https'; + let hkp = (tls ? 'hkps://' : 'hkp://') + this.host; + let del = (tls ? 'https://' : 'http://') + this.host + '/api/v1/removeKey?email=user@example.com'; this.body = `

Welcome to the OpenPGP key server