# CORS policy

Cross-Origin Resource Sharing (CORS) is an HTTP header-based mechanism that lets a server specify which origins can load its resources. An origin includes a domain, scheme, or port. For more information, see the [Mozilla CORS article](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).

Browser security prevents a web page from making requests to a different domain than the one that served it. This restriction also applies to UbiFunctions and helps prevent malicious sites from reading sensitive data. In some cases, you may want to allow other sites to send cross-origin requests to your UbiFunctions.

To enable a CORS policy for a UbiFunction and allow calls from web browsers or the HTML Canvas widget, follow these steps:

**Step 1**: In the Ubidots header, go to **Devices** and select **Functions**.

**Step 2**: Open an existing UbiFunction or create a new one.

**Step 3**: In the UbiFunction settings, enable **CORS policy**.

**Step 4**: Click **Save**.

<figure><img src="/files/tB7bUfUMD73t1fxru01Q" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ubidots.com/ubifunctions/advanced/cors-policy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
