Apply proxy fix for https scheme
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:
Armin Friedl 2020-11-09 06:54:40 +01:00
parent 557ae95406
commit 14487c6f6e
3 changed files with 5 additions and 1 deletions

View file

@ -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 #

View file

@ -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]

View file

@ -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