Skip to content

[Fix] nacos server修改nacos.server.contextPath导致注册失败问题 #300#312

Open
GoofySatoshi wants to merge 2 commits intonacos-group:masterfrom
GoofySatoshi:fix/auth/login-url-context-path
Open

[Fix] nacos server修改nacos.server.contextPath导致注册失败问题 #300#312
GoofySatoshi wants to merge 2 commits intonacos-group:masterfrom
GoofySatoshi:fix/auth/login-url-context-path

Conversation

@GoofySatoshi
Copy link
Copy Markdown

@GoofySatoshi GoofySatoshi commented Mar 12, 2026

Fix Summary

修复了当 context_path='/' 时,访问 login 登录 URL 硬编码产生 token 获取失败的问题。
向前兼容了默认nacos注册中心启动时,默认前缀为/nacos的情况

Changes

  • v2/nacos/common/client_config.py: 优化 context_path 处理逻辑
  • v2/nacos/transport/auth_client.py: 正确拼接登录 URL

Test Coverage

 $ python -m unittest test.client_v2_test.TestClientV2.test_auth_login_url_with_root_context_path ok $ python -m unittest test.client_v2_test.TestClientV2.test_auth_login_url_with_standard_context_path ok
- Fixed 'get access token failed' error when nacos.server.contextPath is customized - Updated auth_client.py to correctly construct the login URL with the server context path - Ensures compatibility with Nacos Server 3.0.3+ custom context configurations - Resolves issue nacos-group#300
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 12, 2026

CLA assistant check
All committers have signed the CLA.

@GoofySatoshi GoofySatoshi changed the title Fix/auth/login url context path [Fix] nacos server修改nacos.server.contextPath导致注册失败问题 #300 Mar 20, 2026
@GoofySatoshi
Copy link
Copy Markdown
Author

@Sunrisea Hello, may I politely ask if you could review this PR when you’re available? Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants