0

I have an airflow deployed in kubernetes. When I curl the base_url, it shows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
* Connection #0 to host <my_base_url> left intact
<p>You should be redirected automatically to target URL: <a href="/admin/">/admin/</a>.  If not click the link.

If I browse base_url/health shows that is healthy. If I run the kubectl port-forward command, I can see the UI.

What is causing the redirecting message?

alltej
  • 6,787
  • 10
  • 46
  • 87
  • Pass `-L` to your curl. Your browser follows the request. – suren Jan 26 '20 at 22:29
  • I am using airflow 1.10.7. I think it has something to do with the `enable_proxy_fix` config. If you set it false, it will get stuck trying to load the page. If you set to true, you will get the proxy error which is related the bug for this PR - https://github.com/apache/airflow/pull/6901 – alltej Jan 27 '20 at 04:27
  • If `enable_proxy_fix` is set to `True` it will give error [ File "/usr/local/lib/python3.7/site-packages/werkzeug/middleware/proxy_fix.py", line 195, in __call__ x_for = self._get_trusted_comma(self.x_for, environ_get("HTTP_X_FORWARDED_FOR")) File "/usr/local/lib/python3.7/site-packages/werkzeug/middleware/proxy_fix.py", line 166, in _get_trusted_comma if len(values) >= trusted: TypeError: '>=' not supported between instances of 'int' and 'str']. – alltej Jan 27 '20 at 13:27
  • can you show your curl command? – suren Jan 27 '20 at 13:43

1 Answers1

1

The solution that works for me is setting the environment variable.

FORWARDED_ALLOW_IPS = *

Add this environment variable in the deployment yaml file.

          env:          
            - name: FORWARDED_ALLOW_IPS
              value: "*"

I have enable_proxy_fix = False set in airflow.cfg.

I found a related SO question here: Cannot access airflow web server via AWS load balancer HTTPS because airflow redirects me to HTTP

alltej
  • 6,787
  • 10
  • 46
  • 87