浏览代码

HUE-2072 [core] Adding support for HTTPS load-balancing

In order to support HTTPS load-balancing that is terminated at the load-balancer level, Hue needs to know that the request came through HTTPS. Django officially supports this by adding SECURE_PROXY_SSL_HEADER to the settings.py file and specifying the HTTP header (X-Forwarded-Protocol) to be set to https.

https://docs.djangoproject.com/en/1.4/ref/settings/#secure-proxy-ssl-header

At the load-balancer level you need to set that HTTP header. Here is the HAProxy example:

```
reqadd X-Forwarded-Protocol:\ https
```
Istvan 11 年之前
父节点
当前提交
b69811f
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      desktop/core/src/desktop/settings.py

+ 3 - 0
desktop/core/src/desktop/settings.py

@@ -345,6 +345,9 @@ if OAUTH_AUTHENTICATION:
 if desktop.conf.REDIRECT_WHITELIST.get():
   MIDDLEWARE_CLASSES.append('desktop.middleware.EnsureSafeRedirectURLMiddleware')
 
+#Support HTTPS load-balancing
+SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
+
 ############################################################
 
 # Necessary for South to not fuzz with tests.  Fixed in South 0.7.1