Skip to content

anonymous blocks are not supported when importing site-level snippet with block #7083

@Vigilans

Description

@Vigilans

For following Caddyfile:

(site) {
  http://{args[0]} https://{args[0]} {
    {block}
  }
}

import site test.domain {
  reverse_proxy http://192.168.1.1:8080 { 
    header_up Host {host}
    header_up X-Real-IP {remote_host}
  }
}

caddy run -c Caddyfile yields

Error: adapting config using caddyfile: anonymous blocks are not supported, at Caddyfile:12

Following Caddyfile will work:

(site) {
  http://{args[0]} https://{args[0]} {
    {block}
  }
}

import site test.domain {
  reverse_proxy http://192.168.1.1:8080
}

Both of followings won't work:

(site) {
  http://{args[0]} https://{args[0]} {
    {block}
  }
}

import site test.domain {
  reverse_proxy http://192.168.1.1:8080 { 
    header_up Host {host}
    header_up X-Real-IP {remote_host}
  }
  reverse_proxy http://192.168.1.1:8080
}
(site) {
  http://{args[0]} https://{args[0]} {
    {block}
  }
}

import site test.domain {
  reverse_proxy http://192.168.1.1:8080 { 
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Something isn't workinghelp wanted 🆘Extra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions