Skip to content

Redirect to landing page when route not found if not authenticated

Zhendi Wang请求将feat/redirect-to-landing-page合并到main-jh

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

  1. 当用户访问 jihulab.com

    • 未登录用户,301 重定向到 SaaS landing page 的地址
    • 用户登录,保留现有逻辑,继续访问 SaaS
  2. 只有登录后才能看的仪表盘类界面 如:https://jihulab.com/-/operations/environmentshttps://jihulab.com/dashboard/projects

    • 未登录用户,301 重定向到 SaaS landing page 的地址
    • 用户登录,保留现有逻辑
  3. 当用户访问不存在页面时,如 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.

  1. set SaaS env in local:
export GITLAB_SIMULATE_SAAS=1
gdk restart
  1. set home page url in admin settings:

Admin Setting -> General -> Sign-in restrictions -> Home page URL

image

  1. 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.

Baodong 编辑于

合并请求报告

加载中