# Set DISCOURSE\_ENABLE\_CORS for hosted forum

**URL:** https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894
**Category:** Self-hosting
**Tags:** hosting
**Created:** [12.Сентябрь.2017 13:05:47 UTC](https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894 "2017-09-12T13:05:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jan\_Curn](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jan\_Curn](https://meta.discourse.org/u/Jan_Curn)
#### Post date: [12.Сентябрь.2017 13:05:47 UTC](https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894/1 "2017-09-12T13:05:47Z")

</div>

Hi there, we’re a hosted Discourse forum running at [forum.apifier.com](http://forum.apifier.com). We’d like to access the forum using the API. I’ve added our website to Settings → Security → cors origins, but still the access doesn’t work. Please can you advice how to set the DISCOURSE\_ENABLE\_CORS env var to true for hosted forum?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12.Сентябрь.2017 23:17:32 UTC](https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894/2 "2017-09-12T23:17:32Z")

</div>

Search your site settings for “CORS”

---

<div class="post-metadata">

### Author: ![Jan\_Curn](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jan\_Curn](https://meta.discourse.org/u/Jan_Curn)
#### Post date: [13.Сентябрь.2017 07:36:17 UTC](https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894/3 "2017-09-13T07:36:17Z")

</div>

I tried that but the only setting I see is the “cors origins”, where they say “The DISCOURSE\_ENABLE\_CORS env variable must be set to true to enable CORS.”. I don’t know where to set this…

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [13.Сентябрь.2017 07:48:35 UTC](https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894/4 "2017-09-13T07:48:35Z")

</div>

You don’t need to do that in a hosted environment.

---

<div class="post-metadata">

### Author: ![Jan\_Curn](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jan\_Curn](https://meta.discourse.org/u/Jan_Curn)
#### Post date: [13.Сентябрь.2017 08:43:16 UTC](https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894/5 "2017-09-13T08:43:16Z")

</div>

Oh great, it seems to be working now, many thanks for your help!

---

<div class="post-metadata">

### Author: ![simonv3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simonv3/32/119552_2.png) [@simonv3](https://meta.discourse.org/u/simonv3)
#### Post date: [07.Октябрь.2022 13:43:14 UTC](https://meta.discourse.org/t/set-discourse-enable-cors-for-hosted-forum/69894/6 "2022-10-07T13:43:14Z")

</div>

Где устанавливается эта переменная окружения в нехостинговой среде? По умолчанию она установлена в true?
