This guide is for users who need to proxy the Frontend API for deployment. If your application already uses a CNAME subdomain that is required for deploying with Clerk, then you must proxy the Frontend API using a different subdomain. Refer to the deployment guide on how to configure DNS records for deployment.
Clerk supports two configuration methods for connecting to the Clerk Frontend API: CNAME and Proxy.
The recommended way to connect to the Clerk Frontend API is to set up CNAME records and use DNS. However, if you're unable to use this approach, or would like more control over your integration with Clerk, you can use a proxy.
When using a proxy, all requests to the Frontend API will be made through your domain. This allows you to use your own SSL certificate, and gives you more control over how you configure your application.
To get started, you need to create an application from the Clerk Dashboard. Once you create an instance via the Clerk Dashboard, you will be prompted to choose a domain. For the purposes of this guide, the domain will be app.dev.
Note
For more information on creating a Clerk application, see the setup guide.
In order to enable proxying, you need to set a proxy URL for your Clerk instance's domain. This can be done through the Clerk Dashboard or through the Backend API.
Note
To avoid downtime, your proxy must be set up according to the above configuration before it can be enabled for your instance.
Make sure your proxy forwards requests to the Clerk Frontend API correctly and includes the required headers.
Dashboard
Backend API
In the Clerk Dashboard, navigate to the Domains page.
In the Frontend API section, select the Advanced dropdown.
In the Proxy URL field, enter your proxy URL. The proxy URL must be a valid URL and resolve correctly.
The request below will update the domain to use the proxy URL https://app.dev/__clerk. In doing so, it will trigger checks to validate the proxy URL.
To configure your proxy setup using environment variables, your .env.local file should look like this:
Next.js
Remix
JavaScript
You will only need to set environment variables in your JavaScript application if you are using a bundler (the NPM module method for ClerkJS installation). If you are using the <script> method, configure your proxy setup using properties in your application instead.