Closed aohanhongzhi closed 8 months ago
Hi @aohanhongzhi ,
as written in #2893 , it would be really helpful if you would use the template we're providing for bugs. In the edit mode it contains also hints what to fill in there.
Please also provide some description of the problem. What have you already tried? have you set spring.boot.admin.ui.public-url
and erver.forward-headers-strategy=native
?
Hi @aohanhongzhi ,
as written(书面) in #2893 , it would(会) be really helpful(乐于助人) if you would(会) use the template we're providing(提供) for bugs. In the edit(编辑) mode(模式) it contains also hints what to fill in there.
Please also provide(提供) some description(描述) of the problem. What have you already tried? have you set
spring.boot.admin.ui.public-url
anderver.forward-headers-strategy=native
?
of course , I have set spring.boot.admin.ui.public-url and erver.forward-headers-strategy=native
, but it not helpful
Hi @aohanhongzhi
I added a sample with nginx proxy here: https://github.com/codecentric/spring-boot-admin-discovery-playground/tree/main/nginx
Maybe now I start understanding your problem (you still did not really describe your setup). From the screenshots in #2893 I guess, that you are talking about the connection between admin server and monitored app. So only your monitored app lives behind the proxy and the url it returns is pointing to the wrong url (private url, not public url of the proxy). So I guess you want to modify the values in the /actuator endpoint? Like in the example from above http://localhost:8888/hello/actuator returns
which contains http://hello-world-nginx:8081/ that would not be reachable from the outside. So Admin Server could not access this, right?
Hint: Actuator is provided by Spring Boot itself, not by Admin. The class in your screenshot is not even from Spring Boot Admin.
Questions:
Hi @aohanhongzhi
I added a sample with nginx proxy here: https://github.com/codecentric/spring-boot-admin-discovery-playground/tree/main/nginx
Maybe now I start understanding your problem (you still did not really describe your setup). From the screenshots in #2893 I guess, that you are talking about the connection between admin server and monitored app. So only your monitored app lives behind the proxy and the url it returns is pointing to the wrong url (private url, not public url of the proxy). So I guess you want to modify the values in the /actuator endpoint? Like in the example from above http://localhost:8888/hello/actuator returns which contains http://hello-world-nginx:8081/ that would not be reachable from the outside. So Admin Server could not access this, right?
Hint: Actuator is provided by Spring Boot itself, not by Admin. The class in your screenshot is not even from Spring Boot Admin.
Questions:
- Is the setup and problem I assumed correct?
- Which discovery/registration mechanism do you use?
bingo , you are right! I didn't use any discovery/registration mechanism
so as your mean , I should solve the problem by modify Actuator to use public url of the proxy
?
I mean, there must be some kind of discovery or registration, the admin server must know the spring apps somehow.
E.g. with self registration you can provide the url (spring.boot.admin.client.instance.health-url
) that the adminserver should use, so it would not use the url that is returned by the actuator anyways, so no need to fix this.
I mean, there must be some kind of discovery or registration, the admin server must know the spring apps somehow.
E.g. with self registration you can provide the url (
spring.boot.admin.client.instance.health-url
) that the adminserver should use, so it would not use the url that is returned by the actuator anyways, so no need to fix this.
I configed spring.boot.admin.client.instance.health-url
, but it is not working.
As I said before, the properties will not change the output of the actuator endpoint. Actuator is provided by Spring Boot and is not influenced by the spring.boot.admin
properties.
So the url in your screenshot is completely out of our control. This is part of Spring Boot itself.
However, the Spring Boot Admin does not use these urls in href. So even if they are wrong, you can get Spring Boot Admin to call the correct urls. Therefore, the client which is used to register can be configured with some different properties, see https://docs.spring-boot-admin.com/current/client.html#spring-boot-admin-client
You would need to set health-url
/management-url
/service-url
depending on your setup. Probably management-url
should be your url with the prod-api
path. Then SBA Server will call the actuator endpoints with this path.
Here as graphical overview:
In the example in the playground (see above) you can simulate that situation by setting
spring.boot.admin.client.instance.service-url: "http://host.docker.internal:8888/hello"
then the admin client would register with that url and admin server would call client through proxy
As I said before, the properties will not change the output of the actuator endpoint. Actuator is provided by Spring Boot and is not influenced by the
spring.boot.admin
properties. So the url in your screenshot is completely out of our control. This is part of Spring Boot itself.However, the Spring Boot Admin does not use these urls in href. So even if they are wrong, you can get Spring Boot Admin to call the correct urls. Therefore, the client which is used to register can be configured with some different properties, see https://docs.spring-boot-admin.com/current/client.html#spring-boot-admin-client You would need to set
health-url
/management-url
/service-url
depending on your setup. Probablymanagement-url
should be your url with theprod-api
path. Then SBA Server will call the actuator endpoints with this path.Here as graphical overview:
In the example in the playground (see above) you can simulate that situation by setting
spring.boot.admin.client.instance.service-url: "http://host.docker.internal:8888/hello"
then the admin client would register with that url and admin server would call client through proxy
unfortunately, it is not working too.
What exactly is "not working"? Do you have any error message?
What exactly is "not working"? Do you have any error message?
I mean this spring.boot.admin.client.instance.service-url still doesn't have a way to configure the post-proxy address
Looking at the Springboot Actuator source code, there's really no way to configure this
Maybe I should go to the Springboot Actuator github and make my request.
thank you very much!
https://github.com/codecentric/spring-boot-admin/issues/2893
https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.webserver.use-behind-a-proxy-server