apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37.06k stars 14.29k forks source link

Set up multiple Airflow instances under the same domain with different sessions #17689

Open rbohlmann1 opened 3 years ago

rbohlmann1 commented 3 years ago

Apache Airflow version: v2.1.1

OS: Ubuntu 20.04.2 LTS

Apache Airflow Provider versions: Not relevent

Deployment: AWS EC2 Instances

What happened: When using multiple Airflow instances (i.e. Production instance and a Development instance) the webserver navigation/redirection can send you back to the incorrect instance.

What you expected to happen: I expect when I press "Back" or "Save" within Airflow (for instance, when editing a 'pool' from the GUI' that it goes back to the previous page (of the instance I am working on, not a different instance that I happen to also be working with at the same time).

How to reproduce it: It seems both webserver instances are using the same cookie or session information. I am using a single NGINX reverse proxy to access both a dev instance and a prod instance (but with a unique URL to differentiate the two)..

Example URLs: https://ec2-myIP.eu-central-1.compute.amazonaws.com/airflow [ points to the PRODUCTION instance ] https://ec2-myIP.eu-central-1.compute.amazonaws.com/airflow_dev [ points to the DEVELOPMENT instance ]

Example ISSUE (using pools as an example, but it is not limited there):

  1. On PRODUCTION instance browse to Admin->Pools
  2. On DEVELOPMENT instance browse to Admin->Pools
  3. On PRODUCTION instance click Airflows Back navigation arrow/button
  4. On DEVELOPMENT instance browse to Admin->Pools, edit a pool, then click Airflows Back navigation arrow/button

Note that the "Save" button can redirect back to the other instance as well (just depends).

Anything else we need to know: Issue occurs frequently when using two independent instances of Airflow. There are no logs to speak of.

Are you willing to submit a PR?

rbohlmann1 commented 3 years ago

Tested using Edge browser

uranusjr commented 3 years ago

The cookies are natively separated by domain, so this is the natural behaviour for sites configured like this. It is theoratically possible to manually prefix all the cookie keys by the mounted prefix, but from my experience even the largest sites and established applications out there don't generally bother to do this (which is also why many of these things use subdomains for multi-setup routing instead), so I'd say we should just document this as unsupported instead of doing substential refactoring.

rbohlmann1 commented 3 years ago

Thank you for the explanation. 🙂

-- Russell Bohlmann @.***


From: Tzu-ping Chung @.> Sent: Tuesday, October 12, 2021 5:10 AM To: apache/airflow @.> Cc: rbohlmann1 @.>; Author @.> Subject: Re: [apache/airflow] Redirect issue when working with multiple instances of Airflow (#17689)

The cookies are natively separated by domain, so this is the natural behaviour for sites configured like this. It is theoratically possible to manually prefix all the cookie keys by the prefix, but from my experience even the largest site and established applications out there don't generally bother to do this (which is also why many of these things use subdomains for multi-setup routing instead), so I'd say we should just document this as unsupported instead of doing substential refactoring.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fairflow%2Fissues%2F17689%23issuecomment-940908158&data=04%7C01%7C%7Cb8311d6b1cfe401d18f908d98d70eecd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637696338442606374%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=bI5vkDovYaDJTCqui3GwUkNJ3uA6JDd6kA%2F6QLuI2sk%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJJQH2GV6ZXGZGAEX6PO37DUGQJTFANCNFSM5CMPAUFA&data=04%7C01%7C%7Cb8311d6b1cfe401d18f908d98d70eecd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637696338442616368%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=BccUKmIOtWbzUdxYIpf2a0T4eJRstdiqVnfXkpQo6WM%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7C%7Cb8311d6b1cfe401d18f908d98d70eecd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637696338442626359%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0j4h%2BTV%2BMcXPOGgOBvExxTCnJvnVQFbu%2BBD9VVqzp9I%3D&reserved=0 or Androidhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7C%7Cb8311d6b1cfe401d18f908d98d70eecd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637696338442626359%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=eToo7fidtBiDQ%2B6fIbEu0OYRj4zC7mgoTIaPsbEgFYA%3D&reserved=0.

eladkal commented 1 year ago

I'm changing this to a documentation task rather than a feature

ronald-fenner commented 1 year ago

I ran into this issue but we are using a single domain with a prefixed route to access the environments deployed, I couldn't use subdomains. A fix that wouldn't require a lot of refactoring would be to provide a web server option in the config to tag the cookies with a prefix, blank by default.

BhaveshSK commented 11 months ago

Hello @eladkal , I am new to the programming domain and would like to contribute to the documentation task. Could you please provide me a point of reference on how I can complete this?