1

We are trying to hit apache airflow stable rest apis from our angular application. But we are getting CORS issue. We have set following in airflow.cfg file:

access_control_allow_headers = origin,content-type,accept

access_control_allow_methods = POST, GET, OPTIONS, DELETE

access_control_allow_origin = *

auth_backend = airflow.api.auth.backend.basic_auth

Still we are not able to see required headers in response.

sayali
  • 71
  • 4

1 Answers1

0

I was trying to get Airflow 2.2.4 running locally on macOS 11.6.4 following the tutorial and using the airflow standalone command.

I kept getting CORS errors:

Access to XMLHttpRequest at 'http://localhost:8000/api/v1/vuex_storage_info' from origin 'http://0.0.0.0:8080' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local.

Inspired by your question, I updated the following values in my airflow.cfg file:

access_control_allow_headers = origin,content-type,accept
access_control_allow_methods = POST, GET, OPTIONS, DELETE
access_control_allow_origin = *
auth_backend = airflow.api.auth.backend.default

(The only difference with your question being setting auth_backend to default).

Then I restarted the Airflow server and it worked.

Details on these settings are in the configuration reference.

Thanks for your help!

Derek Hill
  • 5,965
  • 5
  • 55
  • 74