Distributions
Creating a distribution tells Captain CDN where the content is going to be delivered from, how to manage the content delivery and some other settings on which detailed information are provided.
#
Distribution OverviewWhen you want to use Captain CDN to distribute your content globally, you create a distribution and configure its settings.
Some of the settings that you can configure are listed below:
- Origin of your content - HTTP server of your origin
- Security - if you want CDN to require users to use HTTPS to access your content
- Cache key
- Origin Request settings
- Logs
Captain CDN Distributions can be used to serve content over HTTP or HTTPS, and this content can be static or dynamic and video on demand.
#
Steps to follow when Creating a DistributionThe below section summarizes the process of creating a distribution:
To create a distribution:
- Create Captain CDN Distribution
- For more information on how to create a distribution go to Creating a Distribution
- If you want to create a distribution using Captain CDN API please go to Captain CDN API documentation
- Optionally you can create more than one cache behaviors or origins for your distribution. For more information go to Updating a Captain CDN Distribution
- Test your distribution
- Develop your website or application to access the content using the domain name that Captain CDN assigned to your distribution. In case you specified your own domain name (Alternate Domain Name) for your distribution, you can use your own distribution.
#
Creating a distribution for the first time- Click on Create Distribution on the main Captain CDN screen, follow the steps on the wizard to create a distribution
#
Origin SettingsOrigin Settings is the first page that appears when creating a distribution. It is where you input your information where you host your web content, usually a HTTP web server. When you create or update a distribution, you provide information about one or more locations, where you have your web content stored. These locations are called origins, from which Captain CDN gets the web content and serves it to the viewers, through the edge servers. Your origin can be a HTTP web server.
You can also delete an origin but before doing that, you should first edit or delete the cache behaviors that are connected to that origin.
When you create a distribution, these are the following values that you specify:
- Origin Domain Name - Web server where the content will be served for example, https://example.com
- Origin Path - if you want Captain CDN to request content from a directory on a web server, then enter the directory path, beginning with a /.
- Origin ID - a string that identifies this origin or origin group in a distribution.
- Origin custom headers - if you want to add custom headers when Captain CDN sends a request to the origin server, then you have the option to specify the following values:
- Header Name - the name of the header that you want CDN to add to requests that it sends to the origin server.
- Value - the value for the header.
#
Default Cache BehaviorWhen creating a distribution for the first time, you will create a default cache behavior. After the distribution creaton step, one can update the distribution and add more cache behaviors, if needed. Default cache behavior automatically sends all the requests that come to CDN to the origin server. If more than one cache behavior is created, the default cache behavior should always be the last on the list. When creating a distribution at the second step - default cache behavior - these are the values that the user can set:
- Default Path Pattern - not editable, and is set to * (all files) which means that CDN forwards all the requests to the origin specified in the origin domain name.
- Viewer Protocol Policy- an option to choose the protocol policy that viewers will use when accessing content in the CDN:
- HTTP and HTTPS - viewers can use both protocols.
- Redirect HTTP to HTTPS - vieres can use both protocols, but HTTP requests are automatically redirected to HTTPS requests.
- HTTPS only- viewers can only access content if they are using HTTPS.
- Allowed HTTPS Methods - specify the HTTP methods that Captain CDN to processes and forwards to origin.
- GET, HEAD - choose this option if you want CDN to get objects from your origin or to get object headers.
- GET, HEAD, OPTIONS- you can choose this option if you want CDN to get objects from your origin, get object headers, or retrieve a list of the options that your origin supports.
- GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE - you can choose this option if you want CDN to get, add, update, and delete objects, and to get object headers. Also, perform POST operations such as submitting data from a web form.
- Cached HTTP Methods - you can choose between below options:
- GET and HEAD - CDN caches the response to GET and HEAD requests
- GET, HEAD and OPTIONS - CDN caches the response from the origin when a viewer submits an OPTIONS request.
- Cache Policy - Choose a cache policy. A cache policy specifies the values in the cache key. It also specifies the time to live (TTL) values for objects in the cache. From here you can view the cache policy values or you can create your own cache policy template.
- Origin Request Policy - Choose an origin request policy. An origin request policy specifies the headers, query strings, and cookies that Captain CDN includes in requests that it sends to the origin. From here you can view the origin request policy values or you can create your own origin request policy template.
#
Distribution SettingsSSL Certificates - default CDN Certificate
NOTE: If you want to use a custom SSL certificate with your distribution, you can add it after distribution creation.
Default Root Object - you can configure Captain CDN to return a specific object (the default root object) when a user requests the root URL for your distribution instead of requesting an object in your distribution. Specifying a default root object lets you avoid exposing the contents of your distribution.
Submit - and wait until your configuration is distributed all over the world in our edge locations.
#
Values that are displayedWhen the distribution is created or when a distribution gets updated Captain CDN displays the following information on the Captain CDN Distribution screen.
- Distribution ID - a system generated ID that cannot be changed, if you perform an action on the distribution using the Captain CDN API you should use the Distribution ID.
- Delivery Method - Web
- Domain Name - you use the domain name provided by Captain CDN to get access to your objects. You can not change the domain name but if you have specified one or more Alternate Domain Names (CNAMEs), you can use your own domain name to access your objects.
- Comment - comment for the distribution
- Origins - origin server URL
- CNAME - if you have provided Alternate Domain Names it would appear here.
- Distribution Status - the possible values for a distribution are as below:
- Deploying - the distribution is still being created or updated, and the changes are still being propagated to the edge servers.
- Deployed - the distribution has been created and updated and all the changes are on Captain CDN edge servers.
- Distribution state - which can be either Enabled or Disabled. You can easily disable a distribution from this screen if you click on the Disable button.
- Last Modified - the date and time when the distribution was last updated.
#
Updating a distributionTo update CDN distribution select the Distribution ID from the distribution list view.
#
GeneralWhen you click on Edit you can update the Distribution Settings and add more settings if you wish too. Besides the settings covered when creating a distribution for the first time, you can also provide additional input settings for the distribution:
- Alternative Domain Name (CNAME) - In CDN, an alternate domain name, also known as a CNAME, lets you use your own domain name in your files URLs instead of using the domain name that Captain CDN assigns to your distribution.
- Supported HTTP Versions - you are able to choose between different versions of the HTTP protocol. HTTP/2 is faster, that is why we have pre-selected this version of HTTP Protocol.
- Enable IPv6 - if you have users on IPv6 networks that want to access your content then you should enable this option.
- Enable Image Optimizer - if you want to resize image when using CDN.
- Comment - this field is optional and is a comment for any distribution.
- Distribution State - when the distribution is enabled CDN processes all requests for the content that is associated with this distribution. If the distribution is disabled CDN does not accept any request for the content that is associated with this distribution.
#
Origin and Origin GroupAs mentioned in the origin settings you can create additional origins per distribution, create origin groups and update origin settings. Origin Groups are for scenarios that require high availability. In order to create an origin group, you should have two origins for a distribution. If the primary origin is unavailable or returns a specific HTTP response status code that indicates a failure, Captain CDN switches to the secondary origin. Steps to create an origin failover are simple, first you will need to create an origin group for your distribution that includes two origins, making one as primary, and then create or update a cache behaviour to use the origin group.
#
Additional settings for Origin GroupOrigin and Origin Group is usually intended to create additional origins and origin groups for failover, but you can also update an origin setting and also change some default values that were not in the step when creating a distribution for the first time.
Except the original settings when creating a distribution you can also change additional settings:
- Minimum Origin SSL Protocol - you can choose the minimum TLS/SSL protocol that Captain CDN can use when it establishes a connection to your origin. The default value is TLSv1.
- Origin Protocol Policy - you can specify the protocol policy that you want CDN to use when fetching objects from your origin server. The default value is HTTPS only, but you can change it to HTTP or Match the viewer.
- Origin Connection Attempts - is the number of times Captain CDN tries to connect to the origin.
- Origin Connection Timeout - is the number of seconds that CDN waits when trying to connect to the origin.
These two settings determine how long Captain CDN tries and waits to connect to the origin before failing over to the secondary origin (if available) or returning to the user an error
Default values for these two settings are 3 times for connection attempts and 10 seconds for connection timeout, so Captain CDN waits 30 seconds before attempting to connect to the secondary origin or returning an error response.
- Origin Response Timeout - is the amount of time in seconds that CDN waits for a response from the origin after it forwarded a request to it and the amount of time in seconds, that CDN waits after receiving a packet of a response from the origin and before receiving the next packet. The default timeout is 30 seconds.
- Origin Keep-alive Timeout - is the amount of time in seconds that Captain CDN tries to maintain a connection to your custom origin after it gets the last packet of the response. The default timeout is set to 5. Maintaining a persistent connection saves the time for re-establishing the TCP connection and performing another TLS handshake for subsequent requests. Increasing the time-out helps improve the request-per-connection metric for distribution.
- HTTP Port - the port that the custom origin listens on. Default value is set to 80.
- HTTPS Port - the HTTPS port that the custom origin listens on. Default value is 443.
#
Origin Group SettingsTo create an origin group you must have at least two origins.
- Origin Routing Type - can be either Failover, Round-Robin, Random.
- Origin - Select the origin to add to the origin group
- Origin ID - An ID that can easily distinguish origin groups
- Create - Origin group will appear on the list of origin groups
In order to use this origin group you will need to go to Behaviors and Edit the behavior settings by selecting the Origin Group ID to be used as the Origin for that Behaviour.
#
BehaviorsWhen you first create a distribution you specify the settings for the default cache behavior, which by default forwards all the requests to the origin. After the distribution creation, you can add more cache behaviors or update the default one. Creating more behaviors define how CDN responds to the requests for objects that match a path pattern. When you create additional behaviors the default cache behavior is the last to be processed by the CDN. Additional settings that you specify when creating behaviors are:
- Path Pattern - a path pattern (example images/*.jpg) and a request with images/sample.gif does not satisfy the path pattern therefore the default cache behavior (forwarding the request to the origin) is used. If the request is for a file images/sample.jpg then the path pattern is matched and the object in cache is sent to the requestor.
- Origin and Origin Groups - enter the value of an existing origin or origin group. This identifies the origin or origin group that CDN sends the request to when there is a path pattern match.
#
Error PagesYou can have Captain CDN return an object to the viewer (HTML file), when your origin returns an HTTP 4xx or 5xx status code to Captain CDN.
The following values aren't included when you first create a distribution. In order to configure a custom error page you have to update a distribution.
- HTTP Error Code - from a drop down list you have to choose the HTTP status code for which Captain CDN returns a custom error page.
- Error Caching Minimum TTL - the minimum amount of time in seconds that you want Captain CDN to cache error responses from your origin server.
- Customize Error Pages - HTML file of your custom error page that you want Captain CDN to return to the viewer when your origin returns the HTTP status code that you have specified for Error Code.
- HTTP Response Code - The HTTP status code that you want Captain CDN to return to the viewer along with the custom error page.
#
InvalidationsIf you need to remove a file from Captain CDN cache servers before it expires, you can do the invalidation. To do an invalidation you have to update a distribution and go to the Invalidation tab and specify the path for individual files or a path that ends with the * wildcard, which applies to one or many files.
To invalidate files you have to do the following:
- Select Distribution Settings
- Go to Invalidations tab
- Choose Create Invalidations
- For the files that you want to invalidate enter one path per line.
- Select Invalidate
You can copy an invalidation that you have created previously but you can not cancel an invalidation after you have submitted it.
#
TagsTags are words or phrases that you can use to identify and organize your distributions. You can add multiple tags to each distribution, and each tag includes a key and a value that you define. You can use tags to better search and filter your distribution based on the tags you add, keep track of the billing information and enforce tag-based permissions on Captain CDN distribution.
To add, edit or delete tags for a distribution, do the following:
- Choose the Distribution ID from the list that you want to update
- Choose the Tags tab
- Choose Add or Edit Tags
- On the Add or Edit Tags page, you can:
- Add a tag - enter a key and a value for the tag.
- Edit a tag - change the key, the value or both.
- Delete a tag - choose X on the right side of the value field to delete a tag.
- Choose Save.
#
Deleting a distributionTo delete a Captain CDN distribution do the following:
- In the list of the distribution find the distribution that you want to delete and select it.
- If the value of the State is Disabled, go to Step 7.
- If the value of State is Enabled and the value of Status is Deployed, continue to step 5 to disable the distribution before deleting it.
- If the value of State is Enabled and the value of Status is Deploying, wait until the Status changes to Deployed and then continue to step 5.
- Choose Disable to disable the distribution, and choose Yes, Disable to confirm. Then choose Close.
- The value of State immediately changes to Disabled. Wait until the value of the State changes to deployed.
- Choose Delete, and choose Yes, Delete, to confirm. Then click Close.