> For the complete documentation index, see [llms.txt](https://dev.ubidots.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ubidots.com/ubifunctions/advanced/cors-policy.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
