Apply proxy fix for https scheme
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
sets the wsgi.url_scheme from X-Forwarded-Proto header
This commit is contained in:
parent
557ae95406
commit
14487c6f6e
3 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||||
|
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
|
@ -28,6 +29,8 @@ app.config.update(
|
||||||
SQLALCHEMY_DATABASE_URI = snip_config.SNIP_DATABASE_URI,
|
SQLALCHEMY_DATABASE_URI = snip_config.SNIP_DATABASE_URI,
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = snip_config.SNIP_DATABASE_TRACK_MODIFICATION)
|
SQLALCHEMY_TRACK_MODIFICATIONS = snip_config.SNIP_DATABASE_TRACK_MODIFICATION)
|
||||||
|
|
||||||
|
if snip_config.SNIP_FLASK_PROXYFIX:
|
||||||
|
app = ProxyFix(app)
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Setup SQAlchemy #
|
# Setup SQAlchemy #
|
||||||
|
|
|
@ -47,6 +47,7 @@ class SnipConfig(BaseModel):
|
||||||
# Non-standard flask settings
|
# Non-standard flask settings
|
||||||
SNIP_FLASK_HOST: str = "localhost"
|
SNIP_FLASK_HOST: str = "localhost"
|
||||||
SNIP_FLASK_PORT: int = 5000
|
SNIP_FLASK_PORT: int = 5000
|
||||||
|
SNIP_FLASK_PROXYFIX: bool = False
|
||||||
|
|
||||||
# Snip settings
|
# Snip settings
|
||||||
SNIP_STAGE: Optional[str]
|
SNIP_STAGE: Optional[str]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from flask import render_template, redirect, session, request
|
from flask import render_template, redirect, request
|
||||||
from werkzeug import exceptions
|
from werkzeug import exceptions
|
||||||
|
|
||||||
from . import app
|
from . import app
|
||||||
|
|
Loading…
Reference in a new issue