Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong cloudbeaver path causing redirection to root path #404

Merged
merged 2 commits into from
Mar 28, 2025

Conversation

winfredLIN
Copy link
Collaborator

@winfredLIN winfredLIN commented Mar 28, 2025

User description

issue #340
改动内容:返回给前端的cloudbeaver的路由增加斜杠
改动原因:

  1. 之前的路由缺少斜杠,会导致前端重定向到跟路由,在http开启的情况下和cloudbeaver的路由一致。
  2. 但是开启https后,没有增加斜杠的路由会让web server依然重定向到http的跟路由(从https降级到http),导致使用错误的schema访问dms。访问失败。
  3. 因此需要增加一个斜杠,让web server正确地跳转到cloudbeaver

Description

  • 修复配置文件中启用 HTTPS 时未生效的问题

  • SQLQueryRootURI 添加尾部斜杠,防止重定向错误


Changes walkthrough 📝

Relevant files
Bug fix
cloudbeaver.go
Append trailing slash to fix HTTPS redirection                     

internal/dms/service/cloudbeaver.go

  • Append trailing slash to SQLQueryRootURI in configuration
  • Remove unnecessary blank line in NewAndInitCloudbeaverService function
  • +1/-2     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • …RootURI
    
    - Append trailing slash to SQLQueryRootURI in GetCloudbeaverConfiguration response
    - Remove unnecessary blank line in NewAndInitCloudbeaverService function
    - Add a comment to explain why the trailing slash is necessary
    - Prevent potential redirect issues when DMS is configured with HTTPS
    Copy link

    PR Reviewer Guide 🔍

    🎫 Ticket compliance analysis ✅

    340 - PR Code Verified

    Compliant requirements:

    • 在配置文件中开启https选项
    • 确保HTTPS配置生效,使用https schema访问sqle,使用http无法访问

    Requires further human verification:

    • 启用HTTPS所需的SSL/TLS证书文件(cert.pem 和 key.pem)
    • 在SQLE所在机器配置对DMS的信任
     Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    路径配置

    新添加的 SQLQueryRootURI 确保URL以斜杠结尾,防止HTTPS下Web服务器重定向到HTTP根路径,导致访问错误

    SQLQueryRootURI: cs.CloudbeaverUsecase.GetRootUri() + "/", // 确保URL以斜杠结尾,防止DMS开启HTTPS时,Web服务器重定向到HTTP根路径导致访问错误

    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Copy link
    Collaborator

    @littleniannian littleniannian left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    LGTM

    @littleniannian littleniannian merged commit e1819d7 into main Mar 28, 2025
    1 check passed
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants