cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

CORS - Endpoint issue with CORS

luismolina
New Contributor II

Hi, I have created an endpoint to return information from a RAG system, but when trying to be consumed by external apps, they got a CORS error because they are in a different domain and use javascript to call the API. How can I implement CORS in my endpoint?

Regards.

1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz_Fatma
Community Manager
Community Manager

Hi @luismolinaTo address the CORS (Cross-Origin Resource Sharing) error that external applications are encountering when trying to access your Databricks API endpoint, you can implement CORS in your Databricks workspace.

Here are the steps to do so:

Configure CORS Settings in Databricks

  1. Access the Databricks Admin Console: Log in to your Databricks workspace as an admin user and navigate to the Admin Console.
  2. Enable CORS: In the Admin Console, locate the "CORS" section and enable it.
  3. Add Allowed Origins: In the "Allowed Origins" field, add the URLs of the external applications that need to access your API. You can use wildcards (e.g., https://*.example.com) to allow access from multiple subdomains.
  4. Save the Changes: After adding the allowed origins, save the CORS configuration.

View solution in original post

4 REPLIES 4

Kaniz_Fatma
Community Manager
Community Manager

Hi @luismolinaTo address the CORS (Cross-Origin Resource Sharing) error that external applications are encountering when trying to access your Databricks API endpoint, you can implement CORS in your Databricks workspace.

Here are the steps to do so:

Configure CORS Settings in Databricks

  1. Access the Databricks Admin Console: Log in to your Databricks workspace as an admin user and navigate to the Admin Console.
  2. Enable CORS: In the Admin Console, locate the "CORS" section and enable it.
  3. Add Allowed Origins: In the "Allowed Origins" field, add the URLs of the external applications that need to access your API. You can use wildcards (e.g., https://*.example.com) to allow access from multiple subdomains.
  4. Save the Changes: After adding the allowed origins, save the CORS configuration.

thanks Kanitz

mcoffey
New Contributor II

Hey I am running into the same issue, but even while logged in as a workspace admin cannot see the CORS section. Is there an additional feature I would need to enable to see this. Thanks @Kaniz_Fatma 

galxy25
New Contributor II

@Kaniz_Fatma My company is running into the same issue serving a model via REST API for a web application to call, and like @mcoffey I'm not able to see the CORs section after logging into the workspace as an admin and viewing the settings for the workspace (seeโ€ƒbelow screenshot)

Screenshot 2024-07-24 at 14.50.56.png

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!