博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring项目解决跨域问题
阅读量:4228 次
发布时间:2019-05-26

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

服务器端本身是支持跨域的,所有请求都可以进入后台,只是返回的时候如果不是同源请求,js不接受,防止安全问题,需要服务端在返回头中明确规定支持,则可以接受跨域

设置过滤器允许跨域

GET
POST
HEAD

web.xml中配置过滤器

myCorsFilter
org.springframework.web.filter.DelegatingFilterProxy
targetBeanName
corsFilter
myCorsFilter
/*

这里使用了DelegatingFilterProxy代理corsFilter,这样做的好处是把filter的创建也交给了spring管理。

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

你可能感兴趣的文章
AspectJ Cookbook
查看>>
IntelliJ IDEA in Action
查看>>
HTML Professional Projects
查看>>
Python Cookbook, Second Edition
查看>>
Java Extreme Programming Cookbook
查看>>
XSLT Cookbook
查看>>
Java Programming with Oracle JDBC
查看>>
Hack Proofing Your Network (Second Edition)
查看>>
XML Programming (Core Reference)
查看>>
Visual Studio .NET: The .NET Framework Black Book
查看>>
Best Kept Secrets in .NET
查看>>
SQL: The Complete Reference
查看>>
Wireless Network Hacks & Mods For Dummies
查看>>
Programming INDIGO
查看>>
.NET Development Security Solutions
查看>>
3ds Max 8 Bible
查看>>
Hack Proofing Your Web Applications
查看>>
Hack Proofing ColdFusion
查看>>
Routing TCP/IP, Volume II
查看>>
Unix Systems Programming: Communication, Concurrency and Threads, Second Edition
查看>>