Proksi
  • 🚀General
    • Getting started
    • Performance
    • Motivations
    • Specifications
  • 💾Installation
    • Docker
    • Single binary
  • 📚Configuration
    • HCL
      • Functions
    • YAML
    • ENV
    • Logging
    • Auto Reload
    • Daemon
    • Redis
  • 🔀Routing
    • Upstreams
    • Headers
  • 🧩Plugins
    • Request ID
    • Basic Auth
    • OAuth2
  • đŸ“Ŋī¸Use cases
    • Cache
    • Docker swarm
  • đŸ›Šī¸Contributing
    • Repository
  • Github
  • Crates.io
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Configuration

HCL

Configuration based on the Hashicorp Configuration Language

PreviousSingle binaryNextFunctions

Last updated 4 months ago

Was this helpful?

Configuration

Proksi can be configured using HCL (). This is the recommended way to configure Proksi, as it is more human-readable and easier to work with than JSON or YAML as well as it offers functions that you can use throughout your configuration:

touch proksi.hcl
worker_threads = env("WORKER_THREADS")

server {
  https_address = "0.0.0.0:5143"
}

lets_encrypt {
  enabled = true
  email = env("LETS_ENCRYPT_EMAIL")
  staging = true
}

paths {
  lets_encrypt = env("LETS_ENCRYPT_PATH")
}

// You can split your websites into separate files
routes = [
  import("./sites/mywebsite.com.hcl"),
  import("./sites/myotherwebsite.co.uk.hcl")
]

// Or you can define them here
routes = [
  {
    host = "cdn.example.com"
    ssl_certificate = {
      // Useful for development
      self_signed_on_failure = true
    }
    upstreams = [{
      ip = "example.com"
      port = 443

      headers = {
        add = [
          { name = "Host", value = "example.com" },
          { name = "X-Proxy-For", value = "cdn.example.com" }
        ]
      }
    }]
  }
]
📚
HashiCorp Configuration Language