Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to Werkzeug ProxyFix; expose ProxyFix configuration items #8117

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def get_git_sha():
"contextlib2",
"croniter>=0.3.28",
"cryptography>=2.4.2",
"flask>=1.0.0, <2.0.0",
"flask>=1.1.0, <2.0.0",
mistercrunch marked this conversation as resolved.
Show resolved Hide resolved
"flask-appbuilder>=2.1.9, <2.3.0",
"flask-caching",
"flask-compress",
Expand Down
5 changes: 3 additions & 2 deletions superset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from flask_migrate import Migrate
from flask_talisman import Talisman
from flask_wtf.csrf import CSRFProtect
from werkzeug.contrib.fixers import ProxyFix
mistercrunch marked this conversation as resolved.
Show resolved Hide resolved
import wtforms_json

from superset import config
Expand Down Expand Up @@ -160,7 +159,9 @@ def get_manifest():
CORS(app, **app.config.get("CORS_OPTIONS"))

if app.config.get("ENABLE_PROXY_FIX"):
app.wsgi_app = ProxyFix(app.wsgi_app)
from werkzeug.middleware.proxy_fix import ProxyFix

app.wsgi_app = ProxyFix(app.wsgi_app, **app.config.get("PROXY_FIX_CONFIG"))

if app.config.get("ENABLE_CHUNK_ENCODING"):

Expand Down
7 changes: 7 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@

# Extract and use X-Forwarded-For/X-Forwarded-Proto headers?
ENABLE_PROXY_FIX = False
PROXY_FIX_CONFIG = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was validated to fix the issue with CSM, when ENABLE_PROXY_FIX is set to True.

"x_for": 1,
"x_proto": 0,
"x_host": 1,
"x_port": 0,
"x_prefix": 0,
}

# ------------------------------
# GLOBALS FOR APP Builder
Expand Down