Skip to main content

How to route all the traffic coming to and from Queue-it through your own CloudFront CDN

This feature ensures that all the traffic coming to Queue-it is first routed through your own CloudFront CDN, and in consequence does not hit the Queue-it infrastructure directly.

NOTE: BYO CDN requires the White Label add-on and an Enterprise subscription. If you are unsure if you are eligible to use BYO CDN, reach out to your Queue-it representative.

A specific path prefix must be reserved, so the traffic can go to Queue-it from CloudFront, instead of going to the normal example.com webserver.

Example:

Normal website: https://example.com/
Waiting room URL: https://example.com/queue/

In this example all requests to paths beginning with /queue will be forwarded to Queue-it by CloudFront. This prefix is called Queue Path Prefix.

The Queue Path Prefix is dynamic and can be changed to something else, but it requires changes in Queue-it account setup and the setup in CloudFront. This documentation assumes that the prefix should be /queue. Below setup needs to be adjusted if another prefix must be used and Queue-it's support needs to help with the changes in the Queue-it account setup.

Distribution Setup

Distribution code can be found on GitHub: Queue-it Connector for CloudFront.

NOTE: The version 4 connector repository requires an invite. Please contact Queue-it support for further guidance.

See the Implementation guide for instructions.

Origins Setup

Create the Queue-it Origin

Go to the Origins tab in your CloudFront distribution settings.
Click on Create origin.
In the Origin Domain field, enter your Queue-it domain in the format:

MY_QUEUE_IT_ACCOUNT.queue-it.net

Add your main website’s Origin

If you haven’t already set up your main website origin (your original backend), add a new origin pointing to it now.

If your distribution setup is already complete, you can skip this step.

Setup Queue-it Origin
Setup Your Origin

CloudFront Function Setup

To ensure proper routing through the Queue-it infrastructure, you must create a CloudFront Function or Lambda@Edge that removes the QueuePathPrefix from

incoming requests before they reach the Queue-it systems.

Begin by navigating to the CloudFront service in your AWS Management Console.

In the CloudFront dashboard, select the Functions section and click on Create function to initiate the setup.

Assign a descriptive name to your function to easily identify its purpose within your distribution.

During configuration, ensure that the cloudfront-js-2.0 option is selected under the Runtime settings. This will typically be chosen by default.

In the Build tab, paste the code below to implement the required path prefix removal functionality.

This code checks if the request URI starts with /queue and, if so, removes that prefix. Make sure to adjust the queuePathPrefix variable if your path prefix is different.

Note: x-queueit-proxykey need to "Get from Go Queue-It account-->settings-->integration-->Proxy key"

function handler(event) {
const request = event.request;
// add 'Behind Proxy' headers
request.headers["x-queueit-url"] = { value: getUrl(request) };
request.headers["x-queueit-clientip-yb85x"] = { value: event.viewer.ip };
request.headers["x-queueit-proxykey"] = {
value: "YOUR GO PROXY KEY",
};
request.headers["x-queueit-queuepathprefix"] = {
value: "queue",
};
// remove queue path prefix from the request uri
request.uri = request.uri.substring(
request.uri.indexOf("/", 1),
);
return request;
}
function getUrl(request) {
const url = `https://${request.headers.host.value}${request.uri}`;
const querystring = getQuerystring(request);
if (querystring) {
return `${url}?${querystring}`;
}
return url;
}
// ref: https://github.com/aws-samples/amazon-cloudfront-functions/blob/main/normalize-query-string-parameters/normalize-query-string.js
function getQuerystring(request) {
const querystring = [];
for (var key in request.querystring) {
if (request.querystring[key].multiValue) {
request.querystring[key].multiValue.forEach((mv) => {
querystring.push(key + "=" + mv.value);
});
} else {
querystring.push(key + "=" + request.querystring[key].value);
}
}
return querystring.join("&");
}

Publish the function.

Behaviors Setup

Set the Default (*) behavior to your Origin.

To add a new behavior:

  • Click "Create behavior"

  • Use your QueuePathPrefix (/queue*) for Path Pattern

  • Select your previously created Queue-it origin

  • Set:

Compress objects automatically: Yes
Viewer protocol policy: Redirect HTTP to HTTPS
Allowed HTTP methods: GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE
Cache key and origin requests: No
Cache policy: CachingDisabled
Origin request policy (optional): AllowViewerExceptHostHeader

For Function association (optional), select CloudFront Functions for the Viewer Request and choose the function you created earlier.

GO Queue-it Platform Proxy Setup

Waiting Room Domains

The domain used for the website and the queue page needs to be added as a Waiting Room Domain:

  1. Go to Manage → Waiting Rooms Configuration

  2. Go to Domains tab

  3. Add a new Waiting Room Domain, using the "Create Proxy Domain" button (kindly contact Queue-it if you are not allowed to do it)

  4. Add the domain (e.g. mycompany.com)

  5. add the prefix = queue

Integration Configuration

  1. Go to Integration → Configurations

  2. Create a new configuration or edit an existing one

  3. Select the previously created domain in the dropdown under "Waiting room domain"

  4. Queue Path Proxy: queue

    Update an Integration Rule to use the custom domain

    1. On the Integration Rules (list) page, edit an existing rule

    2. Update the Configuration selection to the new Company domain proxy

    3. Click Save rule

  5. Save and publish the new configuration (Integration → Overview → Publish Now)

Account Settings

The KnownUser SDK version must be changed to at least 4.3:

  1. Go to Account → Settings

  2. Go to Integration tab

  3. Set "Available KnownUser SDK Versions" to 4.3 or higher

Preventing Bypass CDN

The proxy key is also used to prevent bypassing the CDN so no direct requests are sent to Queue-it by bad actors.

To ensure that all requests to Queue-it go through the customer's CDN, the customer should enable the Proxy Key Required option in the GO platform.

  1. Go to Account -> Settings -> Integration tab

  2. Enable "All the requests without the proxy key will be blocked."

  3. Enable "Require proxy key"

Connector Token Type

  1. Go to Waiting Room Settings page

  2. Go to Deployment tab

  3. Change Connector Token Type to QueueIT Security V4

Note this change is not directly related to this "CloudFront CDN in front of Queue-it" feature, but is required to use Connector v4.3.

Manual Setup (by Queue-it)

The Queue Path Prefix is dynamic, but it is currently not possible to change it without first contacting Queue-it.

Did this answer your question?