Example Usage Scenarios and Caching Behavior Control Rules

This section presents examples of common usage scenarios, operation procedures, and caching behavior control rules when using the content delivery service.

Website Content Delivery

  • Example building procedure

    1. Create a virtual server, and build the web server that will be the origin server.
    2. Also build a load balancer (example: http://lb-001.loadbalancing-jp-east-1.cloud.global.fujitsu.com), database and so on as required.
    3. Upload the content to the origin server.
    4. Use a browser to confirm that you can access the origin server.
    5. Use the content delivery service API to create the delivery settings.

      At this time, specify the URL for the load balancer in the caching behavior control rules that you specify in the API parameters. Temporarily specify 3 days (3d) for cache TTL.

    6. When you run the API, you will acquire the delivery URL. (Example: http://xxx-123abc.cdn-edge.cloud.global.fujitsu.com)
    7. Enter the delivery URL in a browser and confirm that you can access the delivery URL.
  • Example of caching behavior control rules

    { 
      "rules": [ 
        { 
          "matches": [ 
            { 
              "name": "url-wildcard", 
              "value": "/*" 
            } 
          ], 
          "behaviors": [ 
            { 
              "name": "origin", 
              "value": "-", 
              "params": { 
                "digitalProperty": "-", 
                "originDomain": "lb-001.loadbalancing-jp-east-1.cloud.global.fujitsu.com", 
                "cacheKeyType": "origin", 
                "cacheKeyValue": "-", 
                "hostHeaderType": "origin", 
                "hostHeaderValue": "-" 
              } 
            }, 
            { 
              "name" : "caching", 
              "type" : "honor" 
              "value" : "3d" 
            } 
          ] 
        } 
      ] 
    }

Content Delivery with a Unique Domain

  • Example building procedure

    Tip: If you are using the DNS service for the name resolution of a unique domain, you should prepare a name and so on for the CNAME setting with a domain name that you own in advance. For details, refer to the DNS service.
    1. Create delivery settings using the procedures described in Website Content Delivery, to acquire the delivery URL.

      At this time, specify a unique domain (example: www.example.com) for delivery FQDN in the API parameters.

    2. Enter the delivery URL in a browser and confirm that you can access the delivery URL.
    3. Use the DNS service to create a CNAME record.

      At this time, create the CNAME settings so that the unique domain points to common-http.cdn-edge.cloud.global.fujitsu.com.

    4. Use a browser to confirm that you can access the unique domain.
  • Example of caching behavior control rules

    { 
      "rules": [ 
        { 
          "matches": [ 
            { 
              "name": "url-wildcard", 
              "value": "/*" 
            } 
          ], 
          "behaviors": [ 
            { 
              "name": "origin", 
              "value": "-", 
              "params": { 
                "digitalProperty": "www.example.com", 
                "originDomain": "lb-001.loadbalancing-jp-east-1.cloud.global.fujitsu.com", 
                "cacheKeyType": "origin", 
                "cacheKeyValue": "-", 
                "hostHeaderType": "origin", 
                "hostHeaderValue": "-" 
              } 
            }, 
            { 
              "name" : "caching", 
              "type" : "honor" 
              "value" : "3d" 
            } 
          ] 
        } 
      ] 
    }

Secure Content Delivery

  • Example building procedure

    1. If the origin server is a virtual server machine or load balancer that you have created, prepare an SSL certificate. For details about what certificates you can use, refer to Secure Delivery.

      Tip: If the origin server can accept only connections via HTTPS, open only port 443.
    2. Create delivery settings using the procedures described in Website Content Delivery.

      At this time, specify https for the delivery protocol in the API parameters. In addition, for the edge server to accept connections via HTTPS only, specify HTTPS in the caching behavior control rules.

    3. When you run the API, you will acquire the delivery URL for HTTPS.
    4. Enter the delivery URL in a browser and confirm that you can access the delivery URL.
  • Example of caching behavior control rules

    { 
      "rules": [ 
        { 
          "matches": [ 
            { 
              "name": "url-wildcard", 
              "value": "/*" 
            }, 
            { 
              "name": "url-scheme", 
              "value": "HTTPS" 
            } 
          ], 
          "behaviors": [ 
            { 
              "name": "origin", 
              "value": "-", 
              "params": { 
                "digitalProperty": "-", 
                "originDomain": "lb-001.loadbalancing-jp-east-1.cloud.global.fujitsu.com", 
                "cacheKeyType": "origin", 
                "cacheKeyValue": "-", 
                "hostHeaderType": "origin", 
                "hostHeaderValue": "-" 
              } 
            }, 
            { 
              "name" : "caching", 
              "type" : "honor" 
              "value" : "3d" 
            } 
          ] 
        } 
      ] 
    }

Secure Content Delivery with a Unique Domain

  • Example building procedure

    Assume that the name of the unique domain for content delivery is "www.example.com", and the domain name of the origin server is "origin.example.com".

    1. First of all, build the origin server (origin.example.com). If the origin server is a virtual server or a load balancer, prepare an SSL certificate and install it yourself. For details about what certificates you can use, refer to Secure Delivery.
    2. For authentication (to confirm the existence of the domain), temporarily assign origin.example.com to www.example.com in the DNS CNAME record. Also, it is necessary to open http port 80 as well as https port 443. Then configure the path for the directory used for authentication in http as the target of redirection of the edge server. A sample is given below.
    3. Apply for www.example.com using an application form. For details, refer to Secure Delivery.
    4. Check the content displayed when the application is complete, and create delivery settings with the API. At this time, specify https for the delivery protocol and www.example.com in the FQDN information in the API parameters.
    5. Use a browser to confirm that you can access the unique domain.
  • Example of addition to the Apache httpd setting file

    <Directory "(DocumentRoot)">
    (omitted)
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/.well-known/acme-challenge/ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule . http://dcv.akamai.com%{REQUEST_URI} [L]
    </Directory>
  • Example of caching behavior control rules

    {
      "rules": [
        {
          "matches": [
            {
              "name": "url-wildcard",
              "value": "/*"
            },
            {
              "name": "url-scheme",
              "value": "HTTPS"
            }
          ],
          "behaviors": [
            {
              "name": "origin",
              "value": "-",
              "params": {
                "digitalProperty": "-",
                "originDomain": "origin.example.com",
                "cacheKeyType": "origin",
                "cacheKeyValue": "-",
                "hostHeaderType": "origin",
                "hostHeaderValue": "-"
              }
            },
            {
              "name" : "caching",
              "type" : "honor"
              "value" : "3d"
            }
          ]
        }
      ]
    }

Replacing Content

In this section, it is assumed that you have created delivery settings using the procedures described in Website Content Delivery.

  • Example operation procedure

    1. Replace image files, PDF files and so on stored in the origin server.
    2. Perform "Purge Cache" for the specified object on the edge server.
    3. Wait a few minutes, and then access the delivery URL from a browser to confirm that the replaced object is displayed.

Reconsidering the Content Update Frequency

In this section, it is assumed that you have created delivery settings using the procedures described in Website Content Delivery.

  • Example operation procedure

    1. Change the TTL setting for the specified object (URL and so on) to 1 hour. (If the cache TTL has an image such as a "good weather," do not make this change.)
    2. Thereafter, cache will be maintained on the edge server for 1 hour.
  • Example of caching behavior control rules

    { 
      "rules": [ 
        { 
          "matches": [ 
            { 
              "name": "url-wildcard", 
              "value": "/*" 
            } 
          ], 
          "behaviors": [ 
            { 
              "name": "origin", 
              "value": "-", 
              "params": { 
                "digitalProperty": "-", 
                "originDomain": "lb-001.loadbalancing-jp-east-1.cloud.global.fujitsu.com", 
                "cacheKeyType": "origin", 
                "cacheKeyValue": "-", 
                "hostHeaderType": "origin", 
                "hostHeaderValue": "-" 
              } 
            }, 
            { 
              "name" : "caching", 
              "type" : "fixed" 
              "value" : "3d" 
            } 
          ], 
          "matches": [ 
            { 
              "name": "url-extension", 
              "value": "jsp" 
            } 
          ], 
          "behaviors": [ 
            { 
              "name" : "caching", 
              "type" : "fixed" 
              "value" : "1h" 
            } 
          ] 
        } 
      ] 
    }

Conditional Access Restrictions

In this section, it is assumed that you have created delivery settings using the procedures described in Website Content Delivery.

  • Example operation procedure

    1. Edit the caching behavior control rules, and use the "Edit Delivery Settings" function to change the access region for the specified path (and lower directories) to Japan only.
    2. Thereafter, access is prevented from all regions other than Japan.
  • Example of caching behavior control rules

    { 
      "rules": [ 
        { 
          "matches": [ 
            { 
              "name": "url-wildcard", 
              "value": "/*" 
            } 
          ], 
          "behaviors": [ 
            { 
              "name": "origin", 
              "value": "-", 
              "params": { 
                "digitalProperty": "-", 
                "originDomain": "lb-001.loadbalancing-jp-east-1.cloud.global.fujitsu.com", 
                "cacheKeyType": "origin", 
                "cacheKeyValue": "-", 
                "hostHeaderType": "origin", 
                "hostHeaderValue": "-" 
              } 
            }, 
            { 
              "name" : "caching", 
              "type" : "honor" 
              "value" : "3d" 
            } 
          ], 
          "matches": [ 
            { 
              "name": "url-wildcard", 
              "value": "/domestic/*" 
            } 
          ], 
          "behaviors": [ 
            { 
              "name": "geo-whitelist", 
              "type": "country", 
              "value": "JP" 
            } 
          ] 
        } 
      ] 
    }

Stopping Content Delivery

  • Example operation procedure

    1. If you are using a unique domain, return the CNAME destination from the delivery URL to a URL such as an on-premises URL.
    2. Use the "Delete Delivery Settings" function to delete the delivery settings.