Skip to content

Commit

Permalink
允许传递cookie时,origin不能为通配符
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix committed Aug 20, 2015
1 parent ab52e38 commit 67c43a4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/edu/scup/web/filter/CORSFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public class CORSFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
throws ServletException, IOException {
response.addHeader("Access-Control-Allow-Origin", "*");
String origin = request.getHeader("Origin");
response.addHeader("Access-Control-Allow-Origin", origin);//允许传递cookie时,origin不能为通配符

if (request.getHeader("Access-Control-Request-Method") != null && "OPTIONS".equals(request.getMethod())) {
// CORS "pre-flight" request
Expand Down

0 comments on commit 67c43a4

Please sign in to comment.