Uploaded image for project: 'Apache Airflow'
  1. Apache Airflow
  2. AIRFLOW-6567

Configuration broken when using proxy_fix

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.10.7
    • Fix Version/s: None
    • Component/s: webserver
    • Labels:
      None

      Description

      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:

      [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'
      

      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

      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)
      

      (row 51-56 in airflow/www/app.py)

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

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                tedvardsson Tobias Edvardsson
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: