Although typically one custom domain is set per Descope Project, if you want to use multiple custom domains with multiple different apps, you can use Cloudflare Workers to do this for you. You can also use a cloudflare worker to help you configure custom domains for each B2B tenant, all using one singular project.
This sample app is built to be deployed as a Cloudflare Worker, utilizing Cloudflare's edge computing capabilities to run serverless code. It is important to ensure that you have configured your Cloudflare account and domain correctly before proceeding with the installation and deployment of this worker.
If you want to learn more about Cloudflare Workers and how this sample app works behind the scenes, you can read our published blog about Descope and Cloudflare Workers.
Before you configure your Cloudflare Worker, you need to:
- Sign up for a Cloudflare account and configure your domain.
- Install the
wrangler
CLI tool:
npm install -g @cloudflare/wrangler
- Authenticate
wrangler
with your Cloudflare account:
wrangler login
To set up your Cloudflare Worker, follow these steps:
- Clone the repository to your local machine.
- Install the project dependencies:
yarn install
- Make sure that your Cloudflare account ID is correctly entered into the
wrangler.toml
file. - The script should already contain the necessary environment variables, such as
BASE_URL
. Verify that these are correct.
Deploy your Worker to Cloudflare by running:
wrangler publish
If you'd like to contribute to the development of this Cloudflare Worker, please follow the standard fork-and-pull-request workflow. Don't forget to update tests as appropriate.
For any issues or suggestions, feel free to open an issue in the GitHub repository.
This project is licensed under the MIT License - see the LICENSE file for details.
Please note that you will need to replace the placeholders like repository URL and any specific details about the worker functionality as needed. Also, ensure that the actual LICENSE
file exists in your repository if you are going to reference it.