如何在Airflow中设置默认的重定向URL?

huangapple go评论93阅读模式
英文:

How can I set up the default redirect URL in Airflow?

问题

我目前在Docker Compose中运行Airflow,可以通过http://localhost:8081访问。然而,每当我访问这个URL时,我会自动重定向到http://localhost:8081/login/?next=http%3A%2F%2Flocalhost%3A8081%2Fhome。这个重定向被定义为登录后要跳转的页面,它将我带到了http://localhost:8081/home

我想要将默认的重定向URL更改为登录后的不同页面。是否可以通过修改配置文件如airflow.cfgwebserver_config.py来实现这一目标?如果能提供关于设置新的默认重定向URL所需的具体配置更改的指导,将不胜感激。谢谢!

英文:

I am currently running Airflow within a docker compose, and it is accessible at http://localhost:8081. However, whenever I access this URL, I am automatically redirected to http://localhost:8081/login/?next=http%3A%2F%2Flocalhost%3A8081%2Fhome. This redirection is defined as the page to go after login, and it takes me to http://localhost:8081/home.

I want to change the default redirect URL to a different page after login. Is there a way to achieve this by modifying the configuration files like airflow.cfg or webserver_config.py? Any guidance on the specific configuration changes needed to set up a new default redirect URL would be greatly appreciated. Thank you!

答案1

得分: 1

当您尝试访问http://localhost:8081时,您将被路由到Web服务器的主页,因为您尚未登录(需要登录),然后Airflow会将您重定向到登录页面,其中包括next=主页(您来自的页面)。

如果您尝试访问另一个URL(如jobs),那么next将是jobs页面。

所以,您在这里所要求的是更改主页,因为重定向是登录流程的一部分。

我不确切知道您访问主页的用途,但您可以将所需页面设置为书签,登录后Airflow会将您重定向到该页面。

英文:

when you trying to go to http://localhost:8081 you are routing to homepage of the webserver. because you don't have access yet (need to login) then airflow redirect you to login page with next=home page (page you came from).

if you where trying to go to another url (like jobs) then the next would be to the jobs page.

so, what you are asking here is to change the home page because the redirect its an infra of how login process works.

I don't know exactly the use of your access homepage but you can make a bookmark to the page you need and airflow would redirect you to it after login

huangapple
  • 本文由 发表于 2023年7月31日 23:46:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76805196.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定