Skip to content

Quantil Documentation

Hello World permalink

Let’s get started with the following simple configuration:

location / {
    return 200 "hello world!\n";

As you probably guessed, this configuration always returns a 200 status code with a body that says "hello world!". The "location" directive indicates that everything within the curly braces is applied to all URIs that begin with "/" (basically every URI). The "return" directive generates a response with the status code value specified in the first parameter and the body specified in the second parameter.

For more information about these two directives, refer to the NGINX documentation site. On the portal, enter only the code above into the "Edge Logic" text area:

hello world

If you use the API to create the property, the following is the complete JSON of the property configuration:

testdomain.json :

  "name":"Hello World Property",
  "description":"This is probably the simplest property",
    "description":"initial version",
    "edgeLogic":"location / {\n return 200 \"hello world!\\n\";\n}",

Note: You must enter the entire Edge Logic code in one line following the JSON string escaping syntax. For example, if you configured the acceleration hostname to be as shown in the JSON above, and then deployed the property to the staging environment, you can use a cURL command to perform the following test:

$ curl -v --resolve
* Added to DNS cache
< HTTP/1.1 200 OK
< Content-Type: application/octet-stream
< Content-Length: 13
< Connection: keep-alive
< Keep-Alive: timeout=30
< Date: Fri, 19 Jul 2019 23:32:35 GMT
< Server: QTL_Cache/
< Accept-Ranges: bytes
hello world!
* Connection #0 to host left intact

In this example, is the IP address of one of the staging servers. For details about using the staging environment, refer to this section.

Under the hood, the CDN Pro API server encloses the Edge Logic into an NGINX "server block" generated for this property. The acceleration hostname "" specified in the property becomes the parameter to the "server_name" directive in this server block. As a result, all HTTP requests targeting are handled by this server block, and the server follows the behavior you defined in the Edge Logic.