title: Angular 7 HttpClient post response headers are empty
body: <p>I am trying to perform login from Angular 7 with Spring security backend:</p>
  
  <pre><code>login(username: string, password: string) {
  
      const formData = new FormData();
      formData.append('username', username);
      formData.append('password', password);
  
      return this.http.post&lt;UserInfo&gt;(`${API_URL}/login`, formData, {observe: 'response'})
        .pipe(map(response =&gt; {
  
          const jwtToken = response.headers.get(AUTHORIZATION).replace('Bearer', '').trim();
          const userInfo = response.body;
  
          if (jwtToken &amp;&amp; userInfo) {
            const user = new User(username, password, jwtToken, userInfo);
            localStorage.setItem(CURRENT_USER, JSON.stringify(user));
            this.currentUserSubject.next(user);
          }
  
          return response;
        }));
    }
  </code></pre>
  
  <p>But, response.headers is simply empty and contains no headers whatsoever. Postman and Chrome dev tools show many headers and even the one I need - Authorization. I have reviewed many SO questions and github issues, but they all say the same thing, which does not work for me - to simply list the header in CORS Access-Control-Expose-Headers, but I have done that and nothing changed. Here is a relevant Spring configuration:</p>
  
  <pre><code>@Bean
      public CorsConfigurationSource corsConfigurationSource() {
          CorsConfiguration configuration = new CorsConfiguration();
          configuration.addAllowedOrigin("http://localhost:4200");
          configuration.addExposedHeader("Authorization");
          configuration.addAllowedMethod("*");
          configuration.addAllowedHeader("*");
          UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
          source.registerCorsConfiguration("/**", configuration);
          return source;
      }
  </code></pre>
  
  <p>At this point I am stuck and have no idea how to make Angular access those headers:</p>
  
  <p><a href="https://i.stack.imgur.com/uxIZ4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uxIZ4.png" alt="enter image description here"></a></p>