oauth-2.0google-oauthflask-appbuilder

Airflow Google OAuth login redirects to 127.0.0.1:8080 instead of domain name


I'm running Airflow 1.10.10 with latest Flask AppBuilder.
I've setup the webserver_config.py to use the AUTH_OAUTH as AUTH_TYPE and set up my provider appropriately. I've allowed my domain name as Authorized URI on the Google Console and that works as well. I've also set up registration on logging with role Admin.

When I click login, I get redirected to choose my G profile. So far, so good.
I click my profile and it redirects me to 127.0.0.1:8080. Obviously I don't have this address in Authorized URI's so it fails there. If I allow it, it's basically useless, because it redirects successfully ... to 127.0.0.1:8080 .. there's nothing there! Airflow is not hosted on my machine.

I've set base_url in airflow.cfg to the full domain name, web_server_host/port is 127.0.0.1/8080, but that shouldn't be the problem. What's the deal?


Solution

  • It turns out I was missing X-Forwarded-Host: <my.domain.com> in my nginx configuration. You should also add X-Forwarded-Proto: https if you want to be redirected to https.