CORS preflight request fails due to a standard header

前端 未结 7 1088
灰色年华
灰色年华 2020-12-23 17:04

While debugging a CORS issue I am experiencing I\'ve found the following behaviour. Chrome makes the following OPTIONS preflight request (rewritten in CURL by Chrome itself)

相关标签:
7条回答
  • 2020-12-23 18:02

    Edit: Enable CORS in security configuration and make sure options requests bypass security

    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {
        httpSecurity
                .cors()
                .and()
                .authorizeRequests()
                .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
                // More security configuration here
    }
    
    0 讨论(0)
提交回复
热议问题