Redirect to landing page when route not found if not authenticated
What does this MR do and why?
Issue link: #2498 (closed)
在用户以下行为访问SaaS内容时,需要重定向到 SaaS landing page: https://www.jihulab.com/
SaaS landing page 的地址配置将由 SRE 同事将 Gitlab::CurrentSettings.home_page_url
设置为 https://www.jihulab.com
-
当用户访问 jihulab.com
- 未登录用户,301 重定向到 SaaS landing page 的地址
- 用户登录,保留现有逻辑,继续访问 SaaS
-
只有登录后才能看的仪表盘类界面 如:https://jihulab.com/-/operations/environments 、 https://jihulab.com/dashboard/projects 等
- 未登录用户,301 重定向到 SaaS landing page 的地址
- 用户登录,保留现有逻辑
-
当用户访问不存在页面时,如 https://jihulab.com/nothing 。
- 未登录用户,301 重定向到 SaaS landing page 的地址 (See:#2498 (comment 2038455))
- 用户登录,保留现有逻辑
详细讨论见 issue:#2498 (closed), 详细的技术方案见 @luzhiyuan.deer 的相关 comment
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- set SaaS env in local:
export GITLAB_SIMULATE_SAAS=1
gdk restart
- set home page url in admin settings:
Admin Setting -> General -> Sign-in restrictions -> Home page URL
- logout account and visit a project/namespace that does not exist, e.g., "http://127.0.0.1:3000/not-exist"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.