Disable redirect from url

I have one url in my project that has a external access, so every url that starts with /api are permitAll(). but now when I try to access and have some validation error the vaadin try to redirect to /login… can I configure to every error that came from a /api/** url are not redirected??

this is my code:

@Override
protected void configure(HttpSecurity http) throws Exception {
http.addFilterBefore(new TenantFilter(), UsernamePasswordAuthenticationFilter.class);
http.addFilterBefore(myAuthorizationFilter, TenantFilter.class);

    http.csrf(csrf -> csrf.ignoringRequestMatchers((new AntPathRequestMatcher("/api/**"))));
    http.authorizeHttpRequests(
            authorize -> authorize.requestMatchers(new AntPathRequestMatcher("/api/**/*")).permitAll());


    http.authorizeHttpRequests(
            authorize -> authorize.requestMatchers(new AntPathRequestMatcher("/images/*.png")).permitAll());
    // Icons from the line-awesome addon
    http.authorizeHttpRequests(authorize -> authorize
            .requestMatchers(new AntPathRequestMatcher("/line-awesome/**/*.svg")).permitAll());

    super.configure(http);
    setLoginView(http, LoginView.class);
}

It would be probably better configure a separated SecurityFilterChain bean for /api
https://docs.spring.io/spring-security/reference/servlet/configuration/java.html#_multiple_httpsecurity_instances

Check this out Configuration | Spring | Integrations | Vaadin Docs