feat(N/A): 修改dev环境的cors配置
This commit is contained in:
@@ -9,5 +9,6 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@ConfigurationProperties(prefix = "cors")
|
@ConfigurationProperties(prefix = "cors")
|
||||||
public class CorsProperties {
|
public class CorsProperties {
|
||||||
private String[] allowedOrigins;
|
private String[] allowedOrigins;
|
||||||
|
private Boolean allowCredentials;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ public class WebCorsConfig implements WebMvcConfigurer {
|
|||||||
.allowedOrigins(corsProperties.getAllowedOrigins())
|
.allowedOrigins(corsProperties.getAllowedOrigins())
|
||||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||||
.allowedHeaders("*")
|
.allowedHeaders("*")
|
||||||
.allowCredentials(true);
|
.allowCredentials(null == corsProperties.getAllowCredentials() || corsProperties.getAllowCredentials());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ server:
|
|||||||
port: 5155
|
port: 5155
|
||||||
|
|
||||||
cors:
|
cors:
|
||||||
|
allowCredentials: false
|
||||||
allowed-origins:
|
allowed-origins:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user