新增跨域支持
This commit is contained in:
parent
b0313feff9
commit
d43089fad2
@ -0,0 +1,17 @@
|
|||||||
|
package dev.surl.surl.cfg.security
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
open class CrossOriginConfig : WebMvcConfigurer {
|
||||||
|
override fun addCorsMappings(registry: CorsRegistry) {
|
||||||
|
registry.addMapping("/**").apply {
|
||||||
|
allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
|
||||||
|
allowedHeaders("*")
|
||||||
|
allowedOrigins("*")
|
||||||
|
maxAge(3600)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user