Hi! Maybe this helps some guys of you out and you understand what I mean :)
After the update to Spring Boot Admin 2 the UI did not work anymore. The UI is behind a Zuul proxy. And our old configuration says:
spring:
boot:
admin:
context-path: /manage/appcon
I checked the new configuration and used the spring.boot.admin.context-path after I saw the base tag in the UI.
<head>
<base th:href="@{${adminContextPath} + '/'}" href="/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="format-detection" content="telephone=no,email=no">
<meta name="theme-color" content="#42d3a5">
<link rel="shortcut icon" href="assets/img/favicon.png" type="image/png">
<link href="assets/css/sba-core.css" rel="stylesheet">
<title>Spring Boot Admin - Login</title>
</head>
Unfortunately, this parameter also means that the endpoints of the service only can be reached under this context path (Like in AbstractInstancesProxyController). Since the URLs are truncated in our proxy, the calls do not work. I think the UI base path should be separate from service path. I fixed that issue for me be creating the ui bean like this. With that we are able to "configure" the base path for the ui
``` private String brand = "Spring Boot Admin";
@Value("${admin.path:/sdi/app/admin/appcon}")
private String adminPath;
@Bean
public UiController homeUiController() {
return new UiController(adminPath,
"My Admin Server",
brand);
}
```
set the adminContextPath to the route (prefix) of your reverse proxy and don't do url rewriting.
This won't fix it.
For example I have a simple Eureka + Zuul and I register my admin-server app to eureka so zuul automatically add it to /admin-server.
But the resources use base path so in my case / which will resolve as /assets/js/vendors.js instead of expected /admin-server/assets/js/vendors.js:
zuul page: http://localhost/admin-server/
direct access page: http://localhost:9000/
If I then add the context-path property and set it to admin-server:
zuul page: http://localhost/admin-server/admin-server/
direct access page: http://localhost:9000/admin-server/
Behind Zuul it expect resource at /admin-server/admin-server/assets/js/vendors.js.
The basePath is based on deployed context which won't work when behind a reverse proxy with different context root. Is this <base> tag necessary?
I'm facing the same problem, however using your suggestion above to create a new @Bean partially works. This allows me to access the UI but I'm presented with the warning message Server connection failed.
Cannot read property 'map' of undefined and no services are displayed.
I was facing a similar problem, i solved it by setting the spring.boot.admin.ui.public-url property.
For example if Zuul is localhost:80/admin and the spring boot admin server is localhost:8080 setting spring.boot.admin.ui.public-url: http://localhost:80/admin/ will change the href in <base> to localhost:80/admin. Note that its not compatible with the adminContextPath property. It seems to override the public-url property
Most helpful comment
This won't fix it.
For example I have a simple Eureka + Zuul and I register my admin-server app to eureka so zuul automatically add it to /admin-server.
But the resources use base path so in my case
/which will resolve as/assets/js/vendors.jsinstead of expected/admin-server/assets/js/vendors.js:zuul page:
http://localhost/admin-server/direct access page:
http://localhost:9000/If I then add the
context-pathproperty and set it toadmin-server:zuul page:
http://localhost/admin-server/admin-server/direct access page:
http://localhost:9000/admin-server/Behind Zuul it expect resource at
/admin-server/admin-server/assets/js/vendors.js.The basePath is based on deployed context which won't work when behind a reverse proxy with different context root. Is this
<base>tag necessary?