1. Output of caddy version
:
v2.5.0 h1:eRHzZ4l3X6Ag3kUt8nj5IxATprhqKq/wToP7OHlXWA0=
2. How I run Caddy:
a. System environment:
Docker caddy:2.5.0-alpine
b. Command:
docker run -d -p 8021:80 [mycaddycontainer]:latest
d. My complete Caddy config:
:80 {
# Set this path to your site's directory.
root * /usr/share/caddy/myapp-desktop
# Enable the static file server.
file_server
}
:8080 {
root * /usr/share/caddy/myapp-mobile
file_server
}
3. The problem I’m having:
The previous Caddyfile works to test my app’s mobile and desktop versions based on two different ports.
The two paths contain static files previously created by Angular.
My question: I would like now to achieve the same based on a string in the domain (not port-based anymore), like as follows:
[long-string]-desktop.myappdomain.com {
root * /usr/share/caddy/myapp-desktop ##folder with Angular compiled files
file_server
}
[long-string]-mobile.myappdomain.com {
root * /usr/share/caddy/myapp-mobile #folder with Angular compiled files
file_server
}
I guess the regex for the domain should be tested to Go’s standard, which I could do. But I have no idea on how to accomplish two different folders containing static files being served by Caddy depending on a string in the domain. Is this even possible?
Any clue would be greatly appreciated.