博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
axios请求携带cookie实现跨域(后端springsecurity)
阅读量:2112 次
发布时间:2019-04-29

本文共 664 字,大约阅读时间需要 2 分钟。

axios请求携带cookie实现跨域(后端springsecurity)

/*CORS跨域配置*/    @Bean    CorsConfigurationSource corsConfigurationSource(){
CorsConfiguration configuration=new CorsConfiguration(); configuration.addAllowedOrigin("http://localhost:3000"); //设置访问源地址 configuration.addAllowedMethod("*"); //设置访问源请求方法 configuration.addAllowedHeader("*"); //设置访问源请求头 configuration.setAllowCredentials(true); //这个证书必须为true,允许携带cookie configuration.applyPermitDefaultValues(); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**",configuration); return source; }

转载地址:http://yksef.baihongyu.com/

你可能感兴趣的文章
google guava使用例子/示范(一)
查看>>
joda-time 时间API
查看>>
Joda Time API -2
查看>>
Spring使用Cache、整合Ehcache
查看>>
Chrome调试工具奇淫技
查看>>
30分钟快速掌握Bootstrap
查看>>
如何针对业务做DB优化
查看>>
程序猿都该知道的MySQL秘籍
查看>>
Eclipse全面提速小技巧
查看>>
前端程序员必知的30个Chrome扩展
查看>>
memcached分布式实现原理
查看>>
怎么成为架构师
查看>>
40个重要的HTML 5面试问题及答案
查看>>
在Java中如何高效判断数组中是否包含某个元素
查看>>
设计模式总结
查看>>
什么时候可以使用Ehcache缓存
查看>>
Java核心知识点-JVM结构和工作方式
查看>>
Java编程中“为了性能”一些尽量做到的地方
查看>>
Java并发编程:线程池的使用
查看>>
redis单机及其集群的搭建
查看>>