Configuration File
The language for Couper's configuration file is HCL 2.0, a configuration language by HashiCorp.
IDE Extension
Couper provides its own IDE extension that adds Couper-specific highlighting and autocompletion to Couper's configuration file couper.hcl in Visual Studio Code.
Get it from the Visual Studio Market Place or visit the Extension repository.
File Name
The file-ending of your configuration file should be .hcl to have syntax highlighting within your IDE.
The file name defaults to couper.hcl in your working directory. This can be changed with the -f command-line flag. With -f /opt/couper/my_conf.hcl couper changes the working directory to /opt/couper and loads my_conf.hcl.
Basic File Structure
Couper's configuration file consists of nested configuration blocks that configure the gateway. There are a large number of options, but let's focus on the main structure first:
server "my_project" {
  files {
    # ...
  }
  spa {
    # ...
  }
  api {
    access_control = ["foo"]
    endpoint "/bar" {
      proxy {
        backend { }
      }
      request "sub-request" {
        backend { }
      }
      response { }
    }
  }
}
definitions {
  # ...
}
settings {
  # ...
}
defaults {
  # ...
}
servermain configuration block(s).filesconfiguration block for file serving.spaconfiguration block for Web serving (SPA assets).apiconfiguration block(s) that bundle(s) endpoints under a certain base path oraccess_controllist.access_controlattribute that sets access control for a block context.endpointconfiguration block for Couper's entry points.proxyconfiguration block for a proxy request and response to an origin.backendconfiguration block for connection to local/remote backend service(s).requestconfiguration block for a manual request to an origin.backendconfiguration block for connection to local/remote backend service(s).responseconfiguration block for a manual client response.definitionsblock for predefined configurations, that can be referenced.settingsblock for server configuration which applies to the running instance.defaultsblock for default/fallback values.