copyright | lastupdated | ||
---|---|---|---|
|
2017-09-11 |
{:shortdesc: .shortdesc} {:new_window: target="_blank"} {:codeblock: .codeblock} {:pre: .pre} {:screen: .screen} {:tip: .tip} {:download: .download}
Learn how to manage your CDN configuration by following these guidelines.
Once you've created a CDN, it appears on your CDN dashboard. Here you'll see the name of your CDN, the Origin, the Provider, and the status.
-
After you've ordered a CDN, you'll need to configure the CNAME with your DNS provider. Most DNS providers can give you instructions on setting or changing the CNAME.
- During this time, your CDN's status will show as CNAME Configuration. Check with your DNS provider to find out when the changes will become active.
-
Any time after you've configured the CNAME with your DNS provider, you may check the status by selecting Get Status from the overflow menu to the right of the CDN's status.
- When the CNAME chaining is complete, the account status changes to RUNNING, and the CDN is ready to use.
Congratulations! Your CDN is now running.
A CDN can be stopped only when in 'Running' status.
-
Click 'Stop CDN' from the Overflow menu (3 vertical dots to the right of the CDN status).
-
A larger dialog window appears, asking to confirm that you want to stop the service. Select Confirm to Proceed.
-
After about 5 to 15 seconds, the status should change to 'Stopped'
A CDN can be started only when in 'Stopped' status
-
Click 'Start CDN' from the Overflow menu, which appears as three dots to the right side of the CDN row.
-
A larger dialog window appears, asking to confirm that you want to start the service. Select Confirm to Proceed.
-
If the action was successful, a dialog box appears in the upper right corner of your screen, letting you know that it was successful, along with the time.
-
This will change the Status to 'CNAME Configuration'
-
Click 'Get Status' from Overflow menu. This will change the status to 'Running'. And CDN will become operational.
To delete a CDN follow the steps below:
NOTE: Selecting Delete
from the overflow menu only deletes the CDN; it will not delete your account.
- Click 'Delete' from the overflow menu.
-
A larger dialog window appears, asking to confirm that you want to delete. Click Delete to Proceed
-
This will change the status to 'Deleting'. Click 'Get Status' from overflow menu. This will remove the row from the CDN list.
After your CDN is running, you can set your content caching time using Time To Live (TTL). The Time To Live for a particular file or directory path indicates how long that content should be cached. When you created the CDN Mapping, a default global TTL of 3600 seconds was created.
-
On the CDN page, select your CDN, which will take you to the Overview page.
-
You can adjust the time using the arrows or by entering a new time. The time value is specified in seconds. For example, 3600 seconds is equal to 1 hour. The smallest value for
timeToLive
that can be chosen is 30 seconds, while the largest is 2147483647 seconds. Select the Save button to set the content caching time.
- After saving, you can Edit or Delete the TTL setting using the overflow menu options. (NOTE: The Path for TTL cannot be changed. If the Mapping path is changed, the TTL path will update automatically.)
-
When the content matches multiple rules, the most recently added configuration will take precedence.
-
TTL values can be set only for a specific file name or directory. Regular expressions are not supported, because they may create unpredictable behavior.
When your CDN is in CNAME_Configuration or Running status, you can add Origin Path details. You can choose to provide content from multiple Origin Servers. For example, photos can be delivered from a different server than videos. The Origin can be based upon a Host Server or Object Storage.
Note: CDN will make a URL transformation for the origin server. For example, if origin xyz.example.com is added with path /example/* when a user opens the URL www.example.com/example/* , the CDN edge server will retrieve the content from xyz.example.com/*
-
On the CDN page, select your CDN, which takes you to the Overview page.
-
Select the Origins tab, then select the Add Origin button.
-
You must provide a path. The path must start with the CDN path as the prefix, if the CDN was created with a path. For example, if the CDN was created with a path of '/examplePath' the path for the Origin must start with prefix '/examplePath/'
-
Select either Server or Object Storage.
- If you selected Server, enter the Origin server address as IPv4 address or the hostname. It is recommended to provide hostname and provide a Fully Qualified Domain Name (FQDN). Provide an HTTP port, an HTTPS port, or both, depending on which protocol you selected during CDN creation.
- If you selected Object Storage, provide the Endpoint, Bucket name, and HTTPS port. Optionally, specify the file extensions that can be used in the CDN service. If nothing is specified, all file extensions are allowed.
Note: The Protocol and Port options shown by the UI will match what was selected during ordering the CDN. For example, if HTTPport was selected as part of ordering a CDN, only the HTTPport option will be shown as part of Add Origin.
- Select the Add button to add your Origin Path.
Note: When you provide file extensions for an Object Storage origin path, the TTL setting that has the same URL as the origin path will be scoped to include all files that have those specified file extensions. For example, if you create an origin path of "/example" and specify file extensions of "jpg png gif", the TTL value of the TTL path "/example" will have a scope that includes all JPG/PNG/GIF files under the "/example" directory and its sub-directories.
- After adding, you can Edit or Delete the Origin using the overflow menu options.
After your CDN is running, you can purge cached content from the Vendor's server.
-
On the CDN page, select your CDN, which takes you to the Overview page.
-
Select the Purge tab.
-
Enter standard unix path syntax to indicate which file you would like to purge, then select the Purge button. Purge is only allowed for a single file at this time.
-
After purging, the activity is listed under Purge Activity. You can Redo purge or Favorite the path using the overflow menu options.
NOTE: If there are more than 15 purges, Purge Activity is trimmed every 15 days automatically.
After your CDN is running, you can update CDN configuration details.
-
On the CDN page, select your CDN, which takes you to the Overview page.
-
Select the Settings tab. Your CDN configuration details are displayed.
For Object Storage, following fields can be changed:
- Endpoint
- Bucket name
- HTTPS Port
- Allowed file extensions
- Serve Stale Content
- Respect Headers
For Server, following fields can be changed:
- Origin server address
- HTTP/HTTPS Port
- Serve Stale Content
- Respect Headers
-
Update the Origin or Other Options details if needed, then click the Save button in the bottom right corner to update your CDN configuration details.
To make use of objects stored in IBM Cloud Object Storage, you must set the value of the "acl" property (that is, the access control list) for each object in your bucket for "public-read" access.
Please refer to the Tools section IBM Cloud Object Storage Developer Center (https://developer.ibm.com/cloudobjectstorage/) to install any neccessary clients or tools. This guide assumes you have installed the official AWS command line interface, which is compatible with IBM Cloud Object Storage S3 API.
The example code below shows how to set "public-read" access for all the objects in your bucket, using the command line interface.
$ export ENDPOINT="YOUR_ENDPOINT"
$ export BUCKET="YOUR_BUCKET"
$ KEYS=( "$(aws --endpoint-url "$ENDPOINT" s3api list-objects --no-paginate --query 'Contents[].{key: Key}' --output text --bucket "$BUCKET")" )
$ for KEY in "${KEYS[@]}"
> do
> aws --endpoint-url "$ENDPOINT" s3api put-object-acl --bucket "$BUCKET" --key "$KEY" --acl "public-read"
> done