title: Enable Access-Control-Allow-Origin in angular 5 from Client side
body: <p>I am using httpClient angular package for get requests. I am using <a href="https://api.independentreserve.com/Public/GetValidPrimaryCurrencyCodes" rel="nofollow noreferrer">https://api.independentreserve.com/Public/GetValidPrimaryCurrencyCodes</a> url for fetching data. It is giving CORS error in console.</p>
  
  <p>I don't have access to server side code, but still I want to enalbe CORS in angular service. This is my service function</p>
  
  <pre><code>myfunction() {
    let head = new HttpHeaders();
    head.append('Access-Control-Allow-Headers', 'Content-Type');
    head.append('Access-Control-Allow-Methods', 'GET');
    head.append('Access-Control-Allow-Origin', '*');
    return this.http.get("https://api.independentreserve.com/Public/GetValidPrimaryCurrencyCodes", {headers: head}).toPromise();
  }
  </code></pre>
  
  <p><strong>I have tried it with <a href="https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en" rel="nofollow noreferrer">chrome cors extension</a>, and it works fine. But I want this to be enabled from angular code.</strong></p>
  
  <p>I have also tried working with proxies, following <a href="https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/proxy.md" rel="nofollow noreferrer">tutorial</a>. BUt it is still not working. This is my object in <strong>proxy.conf.json</strong> file.</p>
  
  <pre><code>{
    "/api": {
      "target": "https://www.independentreserve.com/Public/GetValidPrimaryCurrencyCodes",
      "secure": false
    },
    "changeOrigin": true
  }
  </code></pre>
  
  <p>and added <strong>"start": "ng serve --proxy-config proxy.conf.json"</strong>  in package.json file. It is not working this way either.</p>
  
  <p>Can any body give me some solution?</p>