Checking the start of the requested URL to determine whether it was an https
request simply didn't work. Apache doesn't forward that information. So instead, I'm now using a hacky work-around that looks at the proxy IP to determine whether it was an http or https request. Still need to fix unit tests for this.
This commit is contained in:
parent
9e0b611790
commit
ccb81d18ee
|
@ -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",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
Reference in New Issue