Type to search...

CDN and custom domain settings

Steps

  • contact Shardimage support. You will need to send:
    • cloud ID or IDs for which you would like to set the custom domain.
    • custom domain of your choice which is already registered. (myimage.example.com)
  • the support will set the host and will provide you with the specific data of CNAME record.
  • add CNAME records to DNS
  • the Shardimage image hosting without TLS is ready (only for HTTP)
  • if TLS is required (HTTPS), then please contact Shardimage.com support for further steps.
    • you need to do this if you also need HTTPS communication directly with the Shardimage load balancer.

Please take into consideration the arising costs of setting up your own domain to host images from there.

HTTP connection options

The following connection modes do not cover post-CDN connectivity options (eg browser-CDN connections), in this case please contact your CDN provider.

Connected over HTTP

shardimage LB <---------------------- HTTP ---------------------------> CDN

Connected over non valid certified HTTPS

shardimage LB <--- HTTPS, HTTP2, HTTP2/QUIC (not valid certifcate) ---> CDN

Connected over valid certified HTTPS

shardimage LB <----- HTTPS, HTTP2, HTTP2/QUIC (valid certifcate) -----> CDN

Before you begin

Before you add a DNS CNAME record, please do not forget the following:

  • in order to make the changes suggested here, you need to have access privileges to modify DNS records for your domain.
  • in case you’re planning to use Shardimage on your apex domain (e.g., example.com rather than www.example.com), remember: you can’t use a CNAME record, since we, at present at least, do not offer a solution for this case.

Non-TLS hostnames

If you only need to accept HTTP (Port 80) connections without requiring TLS support, use one of the following hostnames:

[letter].global.shardimage.com.

IMPORTANT: Shardimage’s non-TLS hostnames allow HTTPS connections (port 443), but in this case, TLS certificate mismatch errors will occur.

TLS-enabled hostnames

Please contact Shardimage support.

Updating the CNAME record with your DNS provider

Once you’ve determined the appropriate Shardimage hostname for your domain, the next step is to create a CNAME record. The steps you need to follow will vary depending on your DNS provider’s control panel interface, so please refer to your DNS provider’s documentation for exact instructions on how to create or update a CNAME record.

TIP: If you can’t find your provider’s CNAME configuration instructions, Google maintains instructions for most of the major providers. Please keep in mind that these instructions are maintained by Google, not Shardimage, and are, therefore, tailored specifically to Google enterprise services.

If you run your own DNS server or are familiar with the format of BIND zone files, the CNAME record would look similar to this:

www.example.com.    3600    IN    CNAME   a.global.shardimage.com.

In the above example, the domain set up on Shardimage is www.example.com., with a time-to-live (TTL) of 3600 seconds (1 hour), the Record Type is CNAME, and the Shardimage hostname is a.global.shardimage.com..

Checking your CNAME record

To check your CNAME record, run the following command in a terminal window:

dig img.shardimage.com +short
# dig img.example.com +short

Your output should appear similar to the following:

a.global.shardimage.com.
35.244.133.56
35.244.208.195
35.186.240.36

In most cases, the hostname displayed first will be your current Shardimage hostname (in this case, a.global.shardimage.com.). If you don’t see a Shardimage hostname in the output or see an incorrect Shardimage hostname, then either your CNAME isn’t properly set at your DNS provider or an older CNAME record is still cached by your local DNS resolver.

You can use various online DNS query tools like OpenDNS Cache Check or whatsmydns.net to test the current DNS responses from the different DNS resolvers worldwide.

Removing CNAME records

When you deactivate or delete a service, or cancel your account, we strongly recommend that you modify or delete any CNAME records pointing to Shardimage hostnames. Follow the instructions on your DNS provider’s website, since it will minimize the risk of unauthorized use of your domains.

SDK example

Generating images with custom domain:

use shardimage\shardimagephp\auth\Client;
 
$client = new Client([
    'apiKey' => '<apiKey>',
    'apiSecret' => '<apiSecret>',
    'imageSecret' => '<imageSecret>',
    'cloudId' => '<cloudId>',
    'imageHost' => '<customImageHost>', // setting a new image host if it's not https://img.shardimage.com
]);
$url = $client->getUrlService()->create(['cloudId' => '<cloudId>', 'publicId' => '<publicId>'], ['security' => 'basic']);
var_dump($url);

Good to know: Already generated secure image URLs won’t work if the domain is simply replaced with a new one, they must be generated again.

Table of contents