Hide for webdav

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

a. System environment:

docker

c. Service/unit/compose file:

version: "3.3"
services:
  caddy:
    build: .
    container_name: "caddy"
    restart: always
    ports:
      - "10.100.100.9:80:80"
      - "443:443"
      - "10.100.100.9:2019:2019"
    volumes:
      - "./Caddyfile:/etc/caddy/Caddyfile"
      - data:/data
      - /srv/music:/music
      - /home/marv/library/podcast:/podcast
      - /srv/syncthing/AmselGrafik:/amselgrafik
    networks:
      - http_frontend
      - http_backend
    logging:
      driver: json-file
      options:
        max-size: "200K"
        max-file: "10"
    env_file:
      - ./.env
volumes:
  data:
networks:
  http_frontend:
  http_backend:
    external: true

d. My complete Caddy config:

{
        admin 0.0.0.0:2019 {
                origins 10.100.100.2 10.100.100.4
        }
        order webdav before file_server
}

amsel-grafik.xsfx.dev {
        root * /amselgrafik
        tls {
                dns hetzner {env.HETZNER_API_TOKEN}
        }
        basicauth {
                marv foobar
        }
        webdav
}

3. The problem I’m having:

i want to hide a directory in my webdav directory. is there any way i can do that? everything else runs just fine :slight_smile:

That’s probably a feature request. I suggest you open an issue on GitHub - mholt/caddy-webdav: WebDAV handler module for Caddy to ask for this.

1 Like

ok i done that :slight_smile:

i thought there is maybe a workaround or something.

You can always use matchers to return 404 for certain files; the nice thing about hide is that you give it an absolute path on disk and the server will hide it no matter what form the request path or file root comes in; if the file server is about to serve a file marked as hidden, it will hide it instead. It’s basically just less error-prone. But in the meantime you can use matchers!

@hide path /secret.txt /another.txt
respond @hide 404

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