# Enable CORS on localhost for DiscourseConnect

**URL:** <https://meta.discourse.org/t/enable-cors-on-localhost-for-discourseconnect/291440>\
**Category:** SSO\
**Created:** [January 12, 2024, 3:27pm UTC](https://meta.discourse.org/t/enable-cors-on-localhost-for-discourseconnect/291440 "2024-01-12T15:27:14Z")\
**Posts on this page:** 1\
**Page:** 1

## AI-generated summary

[ewd910](/t/-/291440/1) is seeking assistance with enabling CORS on a locally hosted Discourse instance for development purposes. After following a guide to install Discourse on macOS, the user is implementing SSO with DiscourseConnect. While validation works, a redirect from a WordPress site to Discourse results in a 404 error due to CORS policy blocking the XMLHttpRequest to `localhost:4200/session/sso_login`. Although `localhost:8083` has been added as a valid CORS origin, the user cannot locate the `DISCOURSE_ENABLE_CORS` setting. Since the installation is not running in a Docker container, there is no `app.yml` file, and the setting does not appear in the site settings database. The user asks for the correct method to enable CORS in this non-docker local environment.

<div class="post-metadata">

**Author:** ![ewd910](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ewd910/32/354522_2.png) [@ewd910](https://meta.discourse.org/u/ewd910)\
**Post date:** [January 12, 2024, 3:27pm UTC](https://meta.discourse.org/t/enable-cors-on-localhost-for-discourseconnect/291440/1 "2024-01-12T15:27:14Z")

</div>

Hi, I followed [this guide](https://meta.discourse.org/t/install-discourse-on-macos-for-development/15772)  
to install discourse on my mac for development. I am now implementing SSO with [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true). I’ve got the validation working, but when my WP site redirects to discourse I get a 404

```plaintext
Access to XMLHttpRequest at 'localhost:4200/session/sso_login?sso=[sso]&sig=[sig]' (redirected from 'localhost /login') from origin 'localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

```

I have added localhost:8083 as a valid CORS origin, but I can’t seem to find where I should set `DISCOURSE_ENABLE_CORS ` to `true`. I am not running a docker container so there is no app.yml, and it doesn’t seem to be in the site\_settings table in the database either. What’s the correct way to enable CORS on a locally hosted Discourse site?
