Skip to content

Commit

Permalink
CorsInterceptor skips async dispatch
Browse files Browse the repository at this point in the history
Closes gh-24223
  • Loading branch information
rstoyanchev committed Dec 18, 2019
1 parent 0eacb44 commit 44da775
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -36,6 +36,8 @@
import org.springframework.util.PathMatcher;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.context.request.WebRequestInterceptor;
import org.springframework.web.context.request.async.WebAsyncManager;
import org.springframework.web.context.request.async.WebAsyncUtils;
import org.springframework.web.context.support.WebApplicationObjectSupport;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
Expand Down Expand Up @@ -571,6 +573,12 @@ public CorsInterceptor(@Nullable CorsConfiguration config) {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {

// Consistent with CorsFilter, ignore ASYNC dispatches
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
if (asyncManager.hasConcurrentResult()) {
return true;
}

return corsProcessor.processRequest(this.config, request, response);
}

Expand Down

0 comments on commit 44da775

Please sign in to comment.