We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
老哥, JWTFilter.java中的这段: /** * 对跨域提供支持 */ @OverRide protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
HttpServletRequest httpServletRequest = (HttpServletRequest) request; HttpServletResponse httpServletResponse = (HttpServletResponse) response; httpServletResponse.setHeader("Access-control-Allow-Origin", httpServletRequest.getHeader("Origin")); httpServletResponse.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS,PUT,DELETE"); httpServletResponse.setHeader("Access-Control-Allow-Headers", httpServletRequest.getHeader("Access-Control-Request-Headers")); // 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态 if (httpServletRequest.getMethod().equals(RequestMethod.OPTIONS.name())) { httpServletResponse.setStatus(HttpStatus.OK.value()); return false; } return super.preHandle(request, response); }
对跨域的支持已经淘汰了,直接@crossorigin解决一切问题!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
老哥,
JWTFilter.java中的这段:
/**
* 对跨域提供支持
*/
@OverRide
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
对跨域的支持已经淘汰了,直接@crossorigin解决一切问题!
The text was updated successfully, but these errors were encountered: