Set DISCOURSE_ENABLE_CORS for hosted forum

Hi there, we’re a hosted Discourse forum running at 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?


Search your site settings for “CORS”

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…

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

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


where is this env variable set in a non-hosted environment? is it set to true by default?