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.
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.
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.
Properties in your application
Next.js
Remix
JavaScript
To configure your proxy setup using properties in your Next.js application, set the proxyUrl property on the <ClerkProvider> component.
App Router
Pages Router
To configure your proxy setup using properties in your Remix application, set the proxyUrl property on the ClerkApp wrapper.
To configure your proxy setup using properties in your JavaScript application, pass the proxyUrl option to the load() method.