# Reverse proxy

By implementing a reverse proxy, you're serving Didomi's SDK and API assets through your own domain.

With a reverse proxy, all traffic to your custom domain will be routed first to your infrastructure before being proxied to Didomi if needed. A reverse proxy allows you to do caching and traffic management.

The benefits of a reverse proxy are:

* Enhance performance by leveraging Cloud and Edge providers' caching functionalities.
* Maintain brand consistency and reduce reliance on third-party domains.
* Potentially improve compliance with privacy regulations by controlling SDK delivery.

## Main domain vs Subdomain Implementation

When implementing a reverse proxy for the Didomi SDK and its API events, you need to choose between using your main domain or a dedicated subdomain.

**Main domain implementation:** Serves the SDK through as a subpath on your primary domain (e.g., `domain.com/consent/*` or `www.domain.com/consent/*`) that users access your website on.

**Dedicated subdomain implementation:** Serves the SDK through a separate subdomain (e.g., `sub.domain.com`) directed to the Didomi CMP.

### Set up a reverse proxy

You can implement your own reverse proxy by following the [reverse proxy guidelines](/api-and-platform/domains/reverse-proxy/self-hosting.md).

You can also use one of the implementation guides to set up a reverse proxy with:

* [AWS CloudFront](/api-and-platform/domains/reverse-proxy/implementation-guides/aws-cloudfront.md)
* [Cloudflare](/api-and-platform/domains/reverse-proxy/implementation-guides/cloudflare.md)
* [Fastly](/api-and-platform/domains/reverse-proxy/implementation-guides/fastly.md)


---

# 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://developers.didomi.io/api-and-platform/domains/reverse-proxy.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.
