Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS access_control_allow_origin header never returned #20110

Closed
1 of 2 tasks
Csaki95 opened this issue Dec 7, 2021 · 6 comments · Fixed by #25553
Closed
1 of 2 tasks

CORS access_control_allow_origin header never returned #20110

Csaki95 opened this issue Dec 7, 2021 · 6 comments · Fixed by #25553
Labels
affected_version:2.2 Issues Reported for 2.2 area:webserver Webserver related Issues good first issue kind:bug This is a clearly a bug

Comments

@Csaki95
Copy link

Csaki95 commented Dec 7, 2021

Apache Airflow version

2.2.2 (latest released)

What happened

To fix CORS problem added the access_control_allow_headers, access_control_allow_methods, access_control_allow_origins variables to the 2.2.2 docker-compose file provided in documentation. Both header, and methods returns with the correct value, but origins never does.

What you expected to happen

The CORS response returning with provided origin header value.

How to reproduce

Download the latest docker-compose from documentation add the following lines:
AIRFLOW__API__ACCESS_CONTROL_ALLOW_HEADERS: 'content-type, origin, authorization, accept'
AIRFLOW__API__ACCESS_CONTROL_ALLOW_METHODS: 'GET, POST, OPTIONS, DELETE'
AIRFLOW__API__ACCESS_CONTROL_ALLOW_ORIGINS: '*'

run and call with a CORS preflight

Operating System

Windows 11

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else

It's repeatable regardless of ORIGINS value. There was a name change on this variable that's possibly not handled.
On 2.1.4 the same works without problems.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@Csaki95 Csaki95 added area:core kind:bug This is a clearly a bug labels Dec 7, 2021
@boring-cyborg
Copy link

boring-cyborg bot commented Dec 7, 2021

Thanks for opening your first issue here! Be sure to follow the issue template!

@ashb
Copy link
Member

ashb commented Dec 7, 2021

@ryanahamilton I know you were using and depending on CORS -- any ideas here?

@ashb ashb added area:webserver Webserver related Issues and removed area:core labels Dec 7, 2021
@uranusjr
Copy link
Member

uranusjr commented Dec 8, 2021

Looks like the logic does not handle wildcard expansion:

if allow_origins is not None:
allowed_origins = allow_origins.split(' ')
origin = request.environ.get('HTTP_ORIGIN', allowed_origins[0])
if origin in allowed_origins:
response.headers['Access-Control-Allow-Origin'] = origin

@eladkal eladkal added the affected_version:2.2 Issues Reported for 2.2 label Jan 14, 2022
@Madaditya
Copy link

Was anybody able to fix a fix to the CORS issue for airflow API?
We are facing a similar issue and wondered if its was a v2.2..2 specific.

@uranusjr
Copy link
Member

uranusjr commented Apr 9, 2022

Feel free to fix it, pull requests are open to anyone 🙂

@copypasteearth
Copy link

Has this been fixed I'm having this problem on 2.3.3 and 2.3.4 docker compose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected_version:2.2 Issues Reported for 2.2 area:webserver Webserver related Issues good first issue kind:bug This is a clearly a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants