#community-help

Configuring CORS Settings for Whitelisting Domains

TLDR Fulvio needed help to configure CORS settings to whitelist specific domains. Jason clarified it's not currently supported, but suggested starting the docker container with --enable-cors and reading the documentation.

Powered by Struct AI

1

1

1

Jul 26, 2021 (30 months ago)
Fulvio
Photo of md5-16d994e060b67ac78785fe582156de68
Fulvio
05:25 PM
How can i configura the dns i want to allow in the cors settings..
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:34 PM
Fulvio When you enable CORS, all domains * are whitelisted at the moment. Are you looking to whitelist only certain domains?
Fulvio
Photo of md5-16d994e060b67ac78785fe582156de68
Fulvio
05:37 PM
Im getting Access to XMLHttpRequest at ‘https://ts.domain.com/multi_search?x-typesense-api-key=xxxxxxxx’ from origin ‘https://wv21.domain.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
05:38
Fulvio
05:38 PM
And yes i would like to limit the a few domains instead of letting all of them..
05:38
Fulvio
05:38 PM
Im running the Docker version 0.21.0
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:53 PM
Do you have the --enable-cors command line arg when starting the docker container?
06:54
Jason
06:54 PM
> And yes i would like to limit the a few domains instead of letting all of them..
We don't support narrowing down the list at the moment. Could you open a Github issue about this?

1

Fulvio
Photo of md5-16d994e060b67ac78785fe582156de68
Fulvio
09:40 PM
Like this? /opt/typesense-server --enable-cors

1

09:48
Fulvio
09:48 PM
Ok i found out..
09:48
Fulvio
09:48 PM
TYPESENSE_ENABLE_CORS=true
09:48
Fulvio
09:48 PM
nothing like reading the code 😄
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:59 PM
Haha 🙌
09:59