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

Nacos 2.0.0 Subscriber app is fixed at unknown #5268

Closed
Jisfeng opened this issue Apr 2, 2021 · 2 comments
Closed

Nacos 2.0.0 Subscriber app is fixed at unknown #5268

Jisfeng opened this issue Apr 2, 2021 · 2 comments
Labels
kind/feature type/feature
Milestone

Comments

@Jisfeng
Copy link
Contributor

Jisfeng commented Apr 2, 2021

Describe the bug
Version:Nacos 2.0.0
当客户端指定project.name属性后,订阅服务时,Nacos控制台订阅列表中应用名仍然显示unknown

Expected behavior
应该显示客户端指定的app

原因:在SubscribeServiceRequestHandler#handle中,创建Subscriber对象时写死了app=unknown

        Subscriber subscriber = new Subscriber(meta.getClientIp(), meta.getClientVersion(), "unknown",
                meta.getClientIp(), namespaceId, groupedServiceName, 0, request.getClusters());

解决办法参考:客户端会在request的header里添加了app,服务端可以从request的header中获取

        String app = request.getHeader("app", "unknown");
        Subscriber subscriber = new Subscriber(meta.getClientIp(), meta.getClientVersion(), app,
                meta.getClientIp(), namespaceId, groupedServiceName, 0, request.getClusters());
@horizonzy
Copy link
Collaborator

hello,你能提一个pr来修复吗。

@realJackSun
Copy link
Collaborator

I think this problem has been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature type/feature
Projects
None yet
Development

No branches or pull requests

4 participants