Delete domain by @id

1. Caddy version (caddy version):

Caddy v2.2.1

2. How I run Caddy:

sudo systemctl start caddy

a. System environment:

ubuntu 18.04

d. My complete Caddyfile or JSON config:

{
  "http": {
    "servers": {
      "srv0": {
        "idle_timeout": "10s",
        "listen": [":443"],
        "read_header_timeout": "10s",
        "read_timeout": "10s",
        "routes": [
          {
            "@id": "1-domain",
            "handle": [
              {
                "handler": "subroute",
                "routes": [
                  {
                    "handle": [
                      {
                        "handler": "vars",
                        "root": "/path/to/frontend"
                      }
                    ]
                  },
                  {
                    "handle": [
                      {
                        "handler": "reverse_proxy",
                        "upstreams": [
                          {
                            "dial": "unix//path/to/sockfile.sock"
                          }
                        ]
                      }
                    ],
                    "match": [
                      {
                        "not": [
                          {
                            "path": [
                              "/static*"
                            ]
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "handle": [
                      {
                        "handler": "file_server",
                        "hide": [
                          "/etc/caddy/Caddyfile"
                        ]
                      }
                    ]
                  }
                ]
              }
            ],
            "match": [
              {
                "host": [
                  "www.domain1.tdl"
                ]
              }
            ],
            "terminal": true
          },
          {
            "@id": "2-domain",
            "handle": [
              {
                "handler": "subroute",
                "routes": [
                  {
                    "handle": [
                      {
                        "handler": "vars",
                        "root": "/path/to/frontend/"
                      }
                    ]
                  },
                  {
                    "handle": [
                      {
                        "handler": "reverse_proxy",
                        "upstreams": [
                          {
                            "dial": "unix//path/to/sockfile.sock"
                          }
                        ]
                      }
                    ],
                    "match": [
                      {
                        "not": [
                          {
                            "path": [
                              "/static*"
                            ]
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "handle": [
                      {
                        "handler": "file_server",
                        "hide": [
                          "/etc/caddy/Caddyfile"
                        ]
                      }
                    ]
                  }
                ]
              }
            ],
            "match": [
              {
                "host": [
                  "www.domain2.tdl"
                ]
              }
            ],
            "terminal": true
          }
        ],
        "write_timeout": "10s"
      }
    }
  }
}

3. The problem Iā€™m having:

i want to delete domain by id

i found delete like this but

curl -X DELETE curl http://localhost:2019/config/apps/http/servers/srv0/routes/1

can i delete like this?

curl -X DELETE curl http://localhost:2019/my__domain__id

Thank you

5. What I already tried:

curl -X DELETE curl http://localhost:2019/my__domain__id

Hi,
i found solution.
thank you

"@id": "my__domain__id",
curl -X DELETE http://127.0.0.1:2019/id/my__domain__id
1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.