Tobias Edvardsson created AIRFLOW-6567:
------------------------------------------

             Summary: Configuration broken when using proxy_fix
                 Key: AIRFLOW-6567
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6567
             Project: Apache Airflow
          Issue Type: Bug
          Components: webserver
    Affects Versions: 1.10.7
            Reporter: Tobias Edvardsson


We tried to upgrade from 1.10.6 to 1.10.7 but encountered an issue when trying 
to access the webserver. We are running the solution in kubernetes at AWS 
behind Kong as proxy/gateway.

1.10.6 works niceley but after the upgrade we get the following exception:
{code:java}
[2020-01-15 08:12:02 +0000] [111] [ERROR] Error handling request /1/15/2020 
9:12:02 AM Traceback (most recent call last):1/15/2020 9:12:02 AM   File 
"/usr/local/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 135, in 
handle1/15/2020 9:12:02 AM     self.handle_request(listener, req, client, 
addr)1/15/2020 9:12:02 AM   File 
"/usr/local/lib/python3.7/site-packages/gunicorn/workers/sync.py", line 176, in 
handle_request1/15/2020 9:12:02 AM     respiter = self.wsgi(environ, 
resp.start_response)1/15/2020 9:12:02 AM   File 
"/usr/local/lib/python3.7/site-packages/werkzeug/middleware/dispatcher.py", 
line 66, in __call__1/15/2020 9:12:02 AM     return app(environ, 
start_response)1/15/2020 9:12:02 AM   File 
"/usr/local/lib/python3.7/site-packages/flask/app.py", line 2463, in 
__call__1/15/2020 9:12:02 AM     return self.wsgi_app(environ, 
start_response)1/15/2020 9:12:02 AM   File 
"/usr/local/lib/python3.7/site-packages/werkzeug/middleware/proxy_fix.py", line 
195, in __call__1/15/2020 9:12:02 AM     x_for = 
self._get_trusted_comma(self.x_for, 
environ_get("HTTP_X_FORWARDED_FOR"))1/15/2020 9:12:02 AM   File 
"/usr/local/lib/python3.7/site-packages/werkzeug/middleware/proxy_fix.py", line 
166, in _get_trusted_comma1/15/2020 9:12:02 AM     if len(values) >= 
trusted:1/15/2020 9:12:02 AM TypeError: '>=' not supported between instances of 
'int' and 'str'
{code}
>From my own investigation the issue seem to be the new configuration options 
>for the proxy where the configuration which are fetched returns strings rather 
>then integers as it should.

[https://github.com/apache/airflow/pull/6723]
{code:java}
x_for=conf.get("webserver", "PROXY_FIX_X_FOR", fallback=1),            
x_proto=conf.get("webserver", "PROXY_FIX_X_PROTO", fallback=1),            
x_host=conf.get("webserver", "PROXY_FIX_X_HOST", fallback=1),            
x_port=conf.get("webserver", "PROXY_FIX_X_PORT", fallback=1),            
x_prefix=conf.get("webserver", "PROXY_FIX_X_PREFIX", fallback=1)
{code}
(row 51-56 in airflow/www/app.py)

The following values are expected to be integers and not strings.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to