我注意到只有在 Brave 中,使用 html 代码 @Bean
public CorsConfigurationSource corsConfigurationSource() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowedOrigins(Collections.singletonList("localhost:3000"));
config.setAllowedHeaders(Collections.singletonList("*"));
config.setAllowedMethods(Collections.singletonList("*"));
config.setAllowCredentials(Boolean.FALSE);
source.registerCorsConfiguration("/**", config);
return source;
}
才有效,但如果最后浏览的页面在其他域中,则不会返回。
在 Chrome 中,如果历史记录中的上一页是其他域,则它可以正常工作。
有没有办法解决这个问题?