I am trying to get API data from live server in ionic android app but it returns this error:

```
Access to XMLHttpRequest at 'https://example.com/api/categories/' from origin 'http://192.168.43.71:8100' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

```

### Server settings

Now I am using Laravel for live server which is giving the API here is how I set CORS in my laravel application:

`/bootstrap/app.php`

```
<?php
    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Methods: GET');
    header('Access-Control-Allow-Headers: *');
    // rest of the file

```

due to my setup above I'm getting this result on CORS tester

[![one](https://i.stack.imgur.com/61jGN.png)](https://i.stack.imgur.com/61jGN.png)

### Ionic settings

So I've been reading how to solve this issue and came cross lots of similar solutions and this is what I add to my `ionic.config.json` file

```
"proxies": [
    {
      "path": "/api/*",
      "proxyUrl": "https://example.com/api/"
    }
  ]

```

Get request (ionic services)
----------------------------

Here is how I request my get method

```
apiUrl = 'https://example.com/api/categories/';
  constructor(private http: HttpClient) { }

  getCategories(): Observable<any> {
    return this.http.get(`${this.apiUrl}`).pipe(
      map(categories => categories)
    );
  }

```

**Any idea what else should I do to fix this issue?**