# Does my API server need to CORS-allow capacitor://localhost?

**URL:** <https://forum.ionicframework.com/t/does-my-api-server-need-to-cors-allow-capacitor-localhost/250480>\
**Category:** Capacitor\
**Created:** [January 26, 2026, 9:51am UTC](https://forum.ionicframework.com/t/does-my-api-server-need-to-cors-allow-capacitor-localhost/250480 "2026-01-26T09:51:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tetheredhit](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@tetheredhit](https://forum.ionicframework.com/u/tetheredhit)\
**Post date:** [January 26, 2026, 9:51am UTC](https://forum.ionicframework.com/t/does-my-api-server-need-to-cors-allow-capacitor-localhost/250480/1 "2026-01-26T09:51:59Z")

</div>

Do I need to add capacitor://localhost to allowed origins on my API server for an iOS capacitor app to be able to communicate with the API server?

Or does capacitor wrap fetch such that this shouldn’t be needed?

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [January 26, 2026, 2:36pm UTC](https://forum.ionicframework.com/t/does-my-api-server-need-to-cors-allow-capacitor-localhost/250480/2 "2026-01-26T14:36:24Z")

</div>

If you are using the web stack to make your calls then you need the following origins for CORS on your backend server (these are Capacitor’s defaults):

- iOS: `capacitor://localhost`
- Android: `http://localhost`
- Android: `https://localhost`

If you are using [`CapacitorHttp`](https://capacitorjs.com/docs/apis/http), then CORS doesn’t apply as requests happen in native land outside of the browser. I always recommend sticking with the web stack for making requests if you can as the HTTP plugin adds an extra layer of complexity and latency.

---

<div class="post-metadata">

**Author:** ![tetheredhit](https://avatars.discourse-cdn.com/v4/letter/t/ebca7d/32.png) [@tetheredhit](https://forum.ionicframework.com/u/tetheredhit)\
**Post date:** [January 26, 2026, 6:04pm UTC](https://forum.ionicframework.com/t/does-my-api-server-need-to-cors-allow-capacitor-localhost/250480/3 "2026-01-26T18:04:08Z")

</div>

I thought CapacitorHttp was capacitor’s default behaviour by now?

---

<div class="post-metadata">

**Author:** ![twestrick](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/twestrick/32/136131_2.png) [@twestrick](https://forum.ionicframework.com/u/twestrick)\
**Post date:** [January 26, 2026, 6:37pm UTC](https://forum.ionicframework.com/t/does-my-api-server-need-to-cors-allow-capacitor-localhost/250480/4 "2026-01-26T18:37:36Z")

</div>

Nope.

> By default, the patching of `window.fetch` and `XMLHttpRequest` to use native libraries is disabled. ([source](https://capacitorjs.com/docs/apis/http#configuration))
