mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-24 13:38:11 +00:00
Fix issue where Force HTTPS was ignored
This commit is contained in:
parent
a5bc98c510
commit
347fb1b607
|
@ -677,9 +677,11 @@ def internal_error(error):
|
||||||
# Check for forced HTTPS
|
# Check for forced HTTPS
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def before_request():
|
def before_request():
|
||||||
if is_https_forced():
|
# Check for HTTPS forced (only enforce once drive mounted and stable state)
|
||||||
scheme = request.headers.get('X-Forwarded-Proto')
|
# Otherwise, web GUI may be inaccessible if error occurs (NGINX needs drive for cert)
|
||||||
if scheme and scheme == 'http' and request.url.startswith('http://'):
|
if is_https_forced() and get_mynode_status() == STATE_STABLE:
|
||||||
|
if request.url and request.url.startswith('http://'):
|
||||||
|
app.logger.info("REDIRECTING")
|
||||||
url = request.url.replace('http://', 'https://', 1)
|
url = request.url.replace('http://', 'https://', 1)
|
||||||
code = 302
|
code = 302
|
||||||
app.logger.info("Redirecting to HTTPS ({})".format(url))
|
app.logger.info("Redirecting to HTTPS ({})".format(url))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user