title: ERROR "ERR_INVALID_REDIRECT" to Form Login
body: <p>Why does this error come out when authorizing the user. Did everything according to instructions.</p>
  
  <p>It is  not working with HTTPS. In HTTP all normal.</p>
  
  <p>everything works fine except the login form....</p>
  
  <p>@EnableWebSecurity
  public class ConfigSecurity extends WebSecurityConfigurerAdapter{</p>
  
  <pre><code>@Autowired private UserDetailsService userDetailsService;
  
  @Autowired
  public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
          //auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
          auth.userDetailsService(userDetailsService).passwordEncoder(NoOpPasswordEncoder.getInstance());
  }
  
  @Override
  protected void configure(HttpSecurity http) throws Exception {
      http
      .authorizeRequests()
          .antMatchers("/accaunt/company/**").hasRole("COMPANY")
          .antMatchers("/accaunt/resume/**").hasRole("WORKER")
          .antMatchers("/accaunt/**").authenticated()
          .anyRequest().permitAll()
      .and()
          /*
           *  установка второго параметра (alwaysUse) в false 
           *  говорит Spring Security что в случае успешной 
           *  авторизации можно перенаправить пользователя на 
           *  ту страничку, с которой он пришел на страницу аутентификации. 
           */
          .formLogin()
          .defaultSuccessUrl("/accaunt/main", true)
          .loginPage("/login")
          .permitAll()
      .and()
          .logout()
          .logoutSuccessUrl("/login")
          .permitAll()
      .and()
          .csrf().disable()
              .requiresChannel() //config request to use the mapping to a required channel
                  .anyRequest().requiresSecure();
  
      //maps the port 8080(http) to 8443(https)
      http.portMapper().http(8080).mapsTo(8181); 
  
  }
  </code></pre>
  
  <p>}</p>