我嘗試使用 js 代碼來獲取遠(yuǎn)程(spring boot)js 代碼,它顯示Cross-Origin Read Blocking (CORB) blocked cross-origin response http://45.82.79.208/ with MIME type text/plain. See https://www.chromestatus.com/feature/5629709824032768 for more details我的js代碼:var script = document.createElement("script");script.type = "text/javascript";script.src = "http://45.82.79.208/";document.head.appendChild(script);我的 Spring Boot 代碼,允許 cros:@Configurationpublic class CorsConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") // allow cros path .allowedOrigins("*") // allow cros origin .allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")// allow method .maxAge(168000) // .allowedHeaders("*") .allowCredentials(true); }}我的代碼有問題嗎?如何解決此問題以允許 CORS?
添加回答
舉報(bào)
0/150
提交
取消