diff --git a/config/Common.py b/config/Common.py index 852e9c8..01a3512 100644 --- a/config/Common.py +++ b/config/Common.py @@ -17,5 +17,7 @@ settings = { "decoding_filter.encoding": "utf-8", "luminotes.http_url": "", "luminotes.https_url": "", + "luminotes.http_proxy_ip": "127.0.0.1", + "luminotes.https_proxy_ip": "127.0.0.2", }, } diff --git a/controller/Root.py b/controller/Root.py index 0ea710c..40de2c7 100644 --- a/controller/Root.py +++ b/controller/Root.py @@ -28,7 +28,9 @@ class Root( object ): """ # if the user is logged in and not using https, then redirect to the https version of the page (if available) https_url = self.__settings[ u"global" ].get( u"luminotes.https_url" ) - if cherrypy.session.get( "user_id" ) and https_url and not cherrypy.request.browser_url.startswith( https_url ): + https_proxy_ip = self.__settings[ u"global" ].get( u"luminotes.https_proxy_ip" ) + + if cherrypy.session.get( "user_id" ) and https_url and cherrypy.request.remote_addr != https_proxy_ip: return dict( redirect = https_url ) return dict()