Skip to content

Commit 8946ec4

Browse files
jmcarpAlice Berard
authored and
Alice Berard
committed
[AIRFLOW-3089] Drop hard-coded url scheme in google auth redirect. (apache#3919)
The google auth provider hard-codes the `_scheme` in the callback url to `https` so that airflow generates correct urls when run behind a proxy that terminates tls. But this means that google auth can't be used when running without https--for example, during local development. Also, hard-coding `_scheme` isn't the correct solution to the problem of running behind a proxy. Instead, the proxy should be configured to set the `X-Forwarded-Proto` header to `https`; Flask interprets this header and generates the appropriate callback url without hard-coding the scheme.
1 parent d89279a commit 8946ec4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

airflow/contrib/auth/backends/google_auth.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ def login(self, request):
112112
log.debug('Redirecting user to Google login')
113113
return self.google_oauth.authorize(callback=url_for(
114114
'google_oauth_callback',
115-
_external=True,
116-
_scheme='https'),
115+
_external=True),
117116
state=request.args.get('next') or request.referrer or None)
118117

119118
def get_google_user_profile_info(self, google_token):

0 commit comments

Comments
 (0)