Reject: HTTP ‘DELETE‘ is not allowed, Not injecting HSTS.....DELETE请求PUT请求跨域问题
生活随笔
收集整理的這篇文章主要介紹了
Reject: HTTP ‘DELETE‘ is not allowed, Not injecting HSTS.....DELETE请求PUT请求跨域问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
CORS(DELETE請求、PUT請求)
Reject: HTTP 'DELETE' is not allowed
[DEBUG] 2021-08-25 15:23:52.401 [http-nio-10010-exec-1] HstsHeaderWriter.writeHeaders(169) - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@173b376
[DEBUG] 2021-08-25 15:23:52.402 [http-nio-10010-exec-1] SecurityContextPersistenceFilter.doFilter(119) - SecurityContextHolder now cleared, as request processing completed
解決方法:在繼承WebMvcConfigurer的類中重寫該方法,將要使用的請求類型全部加入,親測已解決。
public void addCorsMappings(CorsRegistry registry) {registry.addMapping("/api/v1/**").allowedOrigins("*").allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE");
}
總結
以上是生活随笔為你收集整理的Reject: HTTP ‘DELETE‘ is not allowed, Not injecting HSTS.....DELETE请求PUT请求跨域问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决gitte提交报错 error: G
- 下一篇: Not injecting HSTS h