> For the complete documentation index, see [llms.txt](https://docs.xaman.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xaman.dev/environments/xapps-dapps/cors-xapp.md).

# CORS (xApp)

CORS restricts access to resources on different domains to ensure privacy and security, allowing website owners to control access. As xApps run inside Xaman, allowing CORS is required for xApps.

## Troubleshooting

If an xApp integration doesn't allow for running commands, and the console shows messages like "Couldn't connect to host", problems are a result of the same cause: CORS issues.

* The SDK can't reach Xaman (the app), so:
* "Could not contact Xaman host" error appears, and:
* For example: the `openSignRequest` trigger doesn't fire, the Sign Request doesn't open, and:
* Xaman keeps on trying, and is stalling the init. to see if the host can be reached - yielding "Attempt n » Retry" console messages (just to make sure it isn't a timing issue).

#### Find the cause

Check the following things:

1. Are you getting this messages from your frontend console, or backend (node?)
2. Do you have CORS setup correctly? (Allow iframe loading, allow CORS (origin: `*`)
3. Does your app run over http (instead of https with a valid certificate?)
4. Does your app run over https on a non standard (non TCP 443) port?
5. Some web server configurations don't allow CORS to work on a subdomain. Try running on a FQDN

While #3 and #4 should be valid, we've seen some Android phones where this prevented the integration from working. We use `ngrok` to work around the local http and non standard port development issues.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.xaman.dev/environments/xapps-dapps/cors-xapp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
