Configure static asset origin

Static asset origin

Below is an example of how to configure your Content Delivery Grid to direct all requests for static assets to a separate origin.


  • Section account
  • Section application running Varnish
  • A separate origin for your static assets (e.g. S3 bucket)

In your default.vcl file you can set a header that’s recognizable in Section last-proxy to determine which origin address and host header to make the request with. So you are going to need to define that origin first in your section.config.json file located in the root of your applications git repo. You will be adding a key called alternate_origins under environments.Production.


"environments": {
    "Production": {
        "origin": {
            "address": ""
        "alternate_origins": {
            "assets_example_com": {
                "address": "",
                "host_header": ""


Next we need to tell Varnish Cache when to use and how to define this origin for static assets. We will be using the name we defined in your section.config.json.

sub vcl_recv {
    if (req.url ~ "/some-unique-url-for-static-assets") {
        set req.http.section-origin = "assets_example_com";    

Note: If your origin only accepts traffic on port 80 and you are requesting this resource over HTTPS, you will need to set the X-Forwarded-Proto to http.

set req.http.X-Forwarded-Proto = "http";


This use case is especially helpful if you are requesting your static assets on the same domain (e.g. to utilize HTTP/2, but want to take the load off your default origin when requesting static assets. Section handles all the internals of actually making the request to your assets origin and all you have to do is configure your reverse proxy setup in your git repo!