title: How to configure angular-cli proxy to solve CORS errors
body: <p>I can't figure out why my angular-cli proxy configuration is wrong.
  I'm still getting the CORS error from chrome.</p>
  
  <p>This is the proxy configuration:</p>
  
  <pre><code> "/sites": {
          "target": "http://dati.venezia.it",
          "secure": false,
          "logLevel": "debug",
          "changeOrigin": true,
          "pathRewrite": {
              "^/sites": ""
          }
      }
  </code></pre>
  
  <p>This is the request made by the component</p>
  
  <pre><code>ngOnInit() {
      this.getData()
    }
  
    getBaseUrl() {
      return 'http://dati.venezia.it/';
    }
  
    getData(){
      const headers = new HttpHeaders({ 'Content-Type': 'text/plain' });
      this.http.get(this.getBaseUrl() + 'sites/default/files/dataset/opendata/temparia.json', { responseType: 'text', headers }).subscribe(
        data =&gt; {
          console.log('getData OK -&gt; ', data);
  
        },
        error =&gt; { 
          console.log('getData ERROR -&gt; ', error) 
        }
      )
    }
  </code></pre>
  
  <h2>Note</h2>
  
  <ol>
  <li>The proxy is working, I can see the rules applied in console</li>
  </ol>
  
  <pre><code>[HPM] Proxy rewrite rule created: "^/sites" ~&gt; ""
  [HPM] Subscribed to http-proxy events:  [ 'error', 'close' ]
  </code></pre>
  
  <ol start="2">
  <li>Already tried without 'pathRewrite'.</li>
  </ol>
  
  <p>I'm still getting this CORS error, and I don't understand why, can someone help?</p>
  
  <pre><code>Access to XMLHttpRequest at 'http://dati.venezia.it/sites/default/files/dataset/opendata/temparia.json' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>