Repository: incubator-airflow
Updated Branches:
  refs/heads/master e38a4e5d3 -> a8dd6d86d


[AIRFLOW-1163][AIRFLOW-XXX] Add support for x-forwarded-* headers

When running Airflow behind a L7 proxy that sends
x-fowarded-* headers, the Flask app miscontructs
redirect URIs.

Closes #3580 from c4milo/master


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/a8dd6d86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/a8dd6d86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/a8dd6d86

Branch: refs/heads/master
Commit: a8dd6d86d512af2dcaf77270b18f2f6366bff5e6
Parents: e38a4e5
Author: Camilo Aguilar <[email protected]>
Authored: Fri Jul 6 22:14:20 2018 +0200
Committer: Fokko Driesprong <[email protected]>
Committed: Fri Jul 6 22:14:20 2018 +0200

----------------------------------------------------------------------
 airflow/www/app.py      | 6 ++++--
 airflow/www_rbac/app.py | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/a8dd6d86/airflow/www/app.py
----------------------------------------------------------------------
diff --git a/airflow/www/app.py b/airflow/www/app.py
index e9b101d..6eea5d2 100644
--- a/airflow/www/app.py
+++ b/airflow/www/app.py
@@ -7,9 +7,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -25,6 +25,7 @@ from flask_caching import Cache
 from flask_wtf.csrf import CSRFProtect
 from six.moves.urllib.parse import urlparse
 from werkzeug.wsgi import DispatcherMiddleware
+from werkzeug.contrib.fixers import ProxyFix
 
 import airflow
 from airflow import configuration as conf
@@ -43,6 +44,7 @@ csrf = CSRFProtect()
 
 def create_app(config=None, testing=False):
     app = Flask(__name__)
+    app.wsgi_app = ProxyFix(app.wsgi_app)
     app.secret_key = configuration.conf.get('webserver', 'SECRET_KEY')
     app.config['LOGIN_DISABLED'] = not configuration.conf.getboolean(
         'webserver', 'AUTHENTICATE')

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/a8dd6d86/airflow/www_rbac/app.py
----------------------------------------------------------------------
diff --git a/airflow/www_rbac/app.py b/airflow/www_rbac/app.py
index 85125c6..1004764 100644
--- a/airflow/www_rbac/app.py
+++ b/airflow/www_rbac/app.py
@@ -7,9 +7,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -26,6 +26,7 @@ from flask_caching import Cache
 from flask_wtf.csrf import CSRFProtect
 from six.moves.urllib.parse import urlparse
 from werkzeug.wsgi import DispatcherMiddleware
+from werkzeug.contrib.fixers import ProxyFix
 
 from airflow import settings
 from airflow import configuration as conf
@@ -40,6 +41,7 @@ csrf = CSRFProtect()
 def create_app(config=None, testing=False, app_name="Airflow"):
     global app, appbuilder
     app = Flask(__name__)
+    app.wsgi_app = ProxyFix(app.wsgi_app)
     app.secret_key = conf.get('webserver', 'SECRET_KEY')
 
     airflow_home_path = conf.get('core', 'AIRFLOW_HOME')

Reply via email to