This is an automated email from the ASF dual-hosted git repository.

jihao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new d62f467  [TE] Make HTTPS redirection configurable (#4539)
d62f467 is described below

commit d62f467adc3f33bfe44017835659a920731c36a3
Author: Jihao Zhang <jihzh...@linkedin.com>
AuthorDate: Tue Aug 20 10:20:29 2019 -0700

    [TE] Make HTTPS redirection configurable (#4539)
    
    Make HTTPS redirection configurable.
---
 thirdeye/thirdeye-frontend/app/pods/application/route.js | 11 ++++++-----
 thirdeye/thirdeye-frontend/config/environment.js         |  2 ++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/thirdeye/thirdeye-frontend/app/pods/application/route.js 
b/thirdeye/thirdeye-frontend/app/pods/application/route.js
index 0e289e3..69a2f34 100644
--- a/thirdeye/thirdeye-frontend/app/pods/application/route.js
+++ b/thirdeye/thirdeye-frontend/app/pods/application/route.js
@@ -19,14 +19,15 @@ export default Route.extend(ApplicationRouteMixin, {
     debug: queryParamsConfig
   },
 
-  beforeModel() {
+  beforeModel(transition) {
     // calling this._super to trigger ember-simple-auth's hook
     this._super(...arguments);
 
-    // TODO: Evaluate how to get the environment without ember-cli running in 
backend.
-    // if (config.environment === 'production' && location.protocol != 
'https:') {
-    //   location.href = 'https:' + 
window.location.href.substring(window.location.protocol.length);
-    // }
+    // if configured as https only, redirect http to https, unless in debug 
mode
+    const debug = transition.queryParams.debug || '';
+    if (config.https_only && location.protocol === 'http:' && debug != 'show') 
{
+      location.href = 'https:' + 
window.location.href.substring(window.location.protocol.length);
+    }
 
     // invalidates session if cookie expired
     if (this.get('session.isAuthenticated')) {
diff --git a/thirdeye/thirdeye-frontend/config/environment.js 
b/thirdeye/thirdeye-frontend/config/environment.js
index 5c00e5e..2458b24 100644
--- a/thirdeye/thirdeye-frontend/config/environment.js
+++ b/thirdeye/thirdeye-frontend/config/environment.js
@@ -23,6 +23,8 @@ module.exports = function(environment) {
       directory: 'app/mirage'
     },
 
+    https_only: false,
+
     moment: {
       includeTimezone: 'all'
     },


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to