0

I run caddy with docker. I have my website loaded to /etc/license inside the docker container. When I serve from the root, with the following Caddyfile:

$MYDOMAIN {
  root * /etc/license
  file_server
}

It works as expected, my website loads when i go to $MYDOMAIN. Now I want to put this website under the route /license so when I go to $MYDOMAIN/license I see my website. It seems that it should it be straightforward but I tried everything I could think of and I can't get it to work.

This is my latest attempt Caddyfile:

$MYDOMAIN {
  handle /license {
    root * /etc/license
    file_server
  }

  # handle other routes
}

Does anybody know how to make it work the way I want and why the current setup doesn't work. Thank you

RailTracer
  • 101
  • 1
  • 7

1 Answers1

0

your config has a little mistake. Your folder structure need to be the same as your route. If your subroute is $MYDOMAIN/license/ and your website resides in /etc/license, you need to point your root to the directory one level higher (etc). But I would recommend to create a new directory in license with the same name and your website: /etc/license/license

you could solve it also like this:

$MYDOMAIN {
    # root * /var/wwwroot
    root /license/* /etc/license
    file_server
    #reverse_proxy /api/ localhost:5000
}
Spoomer
  • 38
  • 5