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:

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/**"))));
            authorize -> authorize.requestMatchers(new AntPathRequestMatcher("/api/**/*")).permitAll());

            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());

    setLoginView(http, LoginView.class);

It would be probably better configure a separated SecurityFilterChain bean for /api

Check this out Configuration | Spring | Integrations | Vaadin Docs