Introducing new features. | closed #I388ES spring boot admin 监控 nacos 状态

If you protect the /instances endpoint don’t forget to configure the username and password on your SBA-Client using spring.boot.admin.client.username and spring.boot.admin.client.password.
This commit is contained in:
lengleng 2021-02-19 20:31:01 +08:00
parent b5dfdd55bc
commit 8e76bd48b3
3 changed files with 8 additions and 3 deletions

View File

@ -15,6 +15,8 @@
*/
package com.alibaba.nacos.config;
import javax.annotation.PostConstruct;
import com.alibaba.nacos.core.code.ControllerMethodsCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -25,8 +27,6 @@ import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import javax.annotation.PostConstruct;
/**
* @author yshen
* @author nkorange
@ -52,7 +52,7 @@ public class ConsoleConfig {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedOriginPattern("*");
config.addAllowedHeader("*");
config.setMaxAge(18000L);
config.addAllowedMethod("*");

View File

@ -39,6 +39,10 @@ spring:
useAddressServer: true
management:
endpoints:
web:
exposure:
include: '*'
metrics:
export:
influx:

View File

@ -51,6 +51,7 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
.and().authorizeRequests()
.antMatchers(adminContextPath + "/assets/**"
, adminContextPath + "/login"
, adminContextPath + "/instances/**"
, adminContextPath + "/actuator/**"
).permitAll()
.anyRequest().authenticated()