Important note

The EdgeRules feature is available only on Enterprise plans.

  1. Background

    In some scenarios, it’s good practice to force SSL connections on some or all CDN assets. Below is a definition of a rule that will enable forced SSL for requests to any CDN file/location. We can make this a flexible option by defining a variable for the SSL destination, which will then be enabled for all requests.

  2. Curl Using HTTP Connection Type To Non-SSL URL

             curl -I
             HTTP/1.1 301 Moved Permanently
             Date: Sun, 26 Jan 2014 05:32:43 GMT
             Content-Type: text/html
             Content-Length: 185
             Connection: keep-alive
             Server: NetDNA-cache/2.2
  3. Curl Using HTTPS Connection Type to SSL URL

             curl -I
             HTTP/1.1 200 OK
             Date: Sun, 26 Jan 2014 05:39:57 GMT
             Content-Type: image/x-icon
             Content-Length: 1698
             Connection: keep-alive
             Last-Modified: Wed, 11 Sep 2013 22:38:35 GMT
             X-Type: static/known
             Cache-Control: public, max-age=2592000
             Vary: Accept-Encoding
             Access-Control-Allow-Origin: *
             Server: NetDNA-cache/2.2
             X-Cache: HIT
             Accept-Ranges: bytes
  4. Resulting Nginx Configuration Block

          location / {
                    set $server;
                    if ($server_port = 80) {
                    rewrite ^ https://$server$request_uri permanent;