Customize a waiting room
You can customize your waiting room from the dashboard or via API.
To design and preview the appearance of a waiting room, select the Customization tab in the Create waiting room page.
Cloudflare offers options to customize the appearance of your waiting room:
- Default waiting room: An unbranded waiting room that displays an estimated waiting time to visitors.
- Select a language for your default waiting room page. You can choose from the following languages: English, Arabic, German, Spanish, French, Indonesian, Italian, Japanese, Korean, Dutch, Polish, Portuguese (Brazilian), Turkish and Chinese (Simplified and Traditional).
- Custom waiting room: Edit template text or create your own HTML code:
- Customize both HTML or CSS content, including fonts, colors, static images, additional languages and more.
- Edit content directly in the dashboard or import relevant files.
- Return a JSON-friendly waiting room response: Toggle to also enable a JSON response with a user's status in the waiting room.
To choose the default, unbranded waiting room:
- Select a waiting room.
- Go to the Customization step.
- Select Default waiting room.
- Select the language for your waiting room default page.
To customize a waiting room:
- Select a waiting room.
- Go to the Customization step.
- Select Custom waiting room.
You can edit the HTML code directly in the text box:
- Select Download default template to download a HTML file containing the default template content to your computer.
- Select Download to download a HTML file containing the text box content to your computer.
- Select Copy to copy the text from the text box to your clipboard, then paste it into an editor of your choice.
The template text contains code to display the wait time. If you want to display the estimated wait time to visitors, do not delete this content.
- Select Import to upload a HTML file from your computer.
- Select the file in the dialog and select Open. The HTML file size limit is 1,048,576 bytes (1 MB).
Make further edits in the text box. Include the code to display the wait time to display the estimated queue time on the waiting room page or create your own custom page using available variables.
The following content in the <main>
section of the template HTML code displays the wait time:
The following script within the <body>
section after <main>
fetches the wait time:
When you create a waiting room with custom HTML, you can have access to several variables to customize your response. For a full list of variables, refer to the json_response_enabled
parameter in the Cloudflare API docs.
Customizable waiting rooms can display text in any language supported by the UTF-8 character set. To display estimated wait time, you can use numeric variables like waitTime
and waitTimeHours
within your waiting room template, regardless of user language. However, at the time, the following variables are only available in English: waitTimeFormatted
, timeUntilEventStartFormatted
, and timeUntilEventEndFormatted
.
If you would like to display different languages within your custom waiting room depending on path or subdomain, you can add JavaScript code to your custom HTML to do so. Below you can find a couple of starter templates that you can use as an example to start from:
-
To display a different language based on path, download this template. The template displays the content in English if the path contains
en
or as a default, Japanese if the path containsjp
, French if the path containsfr
, and Spanish if the path containses
. -
To display a different language based on subdomain, download this template. The template displays the content in English as a default or if the subdomain contains
en
, Japanese if the subdomain containsjp
, French if the subdomain containsfr
, and Spanish if the subdomain containses
.
Download either of these templates and customize them however you would like. Update the path or subdomain to reflect your site’s language selection structure. You may edit these templates to include other languages by adding translations to the translations
object for each of the locales.
If you are using images or other resources for your customized waiting room, do not host those assets on the hostname covered by your waiting room. Otherwise, any requests for these assets will not be able to pass through the waiting room.
To preview the appearance of a waiting room:
- In your application, go to Traffic > Waiting Room.
- Either create a waiting room or edit an existing one.
- Go to the Review step.
- Select Preview waiting room:
- Choose Queueing to display the waiting room appearance when it is enabled on the dashboard and Queue-all is not enabled.
- Choose Queue-All to display the waiting room appearance when it is enabled on the dashboard and Queue-all is enabled. When Queue-all is enabled for a waiting room, the estimated wait time is not displayed.
If you notice something unexpected when previewing your waiting room, review your custom code for proper syntax. Often, you might forget to close each tag with its appropriate closing tag (the tag name with a /
).
You can use the Waiting Room API to customize the web page served to visitors when they are placed in a virtual waiting room.
In the following PATCH
request, the custom_page_html
field contains the HTML code for the customized waiting room:
Before making an API request to configure a waiting room web page with customized HTML, you can preview your custom HTML by uploading it to a preview endpoint:
In the request body, include the customized HTML content in the custom_html
field:
Note that you pass HTML content to the preview endpoint in the custom_html
field, but when you are using the API to configure a waiting room, you pass the HTML content in the custom_page_html
field.
Example request:
The preview endpoint returns a temporary URL in the response body where you can preview your custom page:
You do not have to have a Cloudflare account to access the preview link, so you can validate the waiting room webpage on multiple devices.
After generating a preview URL, use the following endpoint to generate a link to preview the currently configured web page for a waiting room, or the default page if no custom page is configured.
The link in the response displays the content of the custom_page_html
field, rendered with mustache ↗.
Use the optional force_queue
query parameter to preview the waiting room web page when all traffic is force-queued.