parent
d03a099350
commit
aeb3256b07
@ -0,0 +1,25 @@ |
||||
package com.unionmed.framework.spring.mvc.filter; |
||||
|
||||
import org.springframework.web.filter.OncePerRequestFilter; |
||||
|
||||
import javax.servlet.FilterChain; |
||||
import javax.servlet.ServletException; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* @author ianChen |
||||
* @date 2023/7/5 15:15 |
||||
*/ |
||||
public class CrossFilter extends OncePerRequestFilter { |
||||
|
||||
@Override |
||||
protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException { |
||||
httpServletResponse.setHeader("Access-Control-Allow-Origin", "*"); |
||||
httpServletResponse.setHeader("Access-Control-Allow-Headers", "*"); |
||||
httpServletResponse.setHeader("Access-Control-Max-Age", "3600"); |
||||
httpServletResponse.setHeader("Access-Control-Allow-Methods", "POST,GET,OPTIONS,DELETE,PUT"); |
||||
filterChain.doFilter(httpServletRequest, httpServletResponse); |
||||
} |
||||
} |
Loading…
Reference in new issue