1. My Caddy version (caddy version
): caddy2 beta 16
2. How I run Caddy:
caddy run --config Caddyfile
a. System environment:
ubuntu 18
b. Command:
d. My complete Caddyfile or JSON config:
{
"apps": {
"http": {
"servers": {
"test": {
"listen": [":80"],
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "rewrite",
"strip_path_prefix": "/api"
},
{
"handler": "reverse_proxy",
"transport": {
"protocol": "http",
"read_buffer_size": 4096
},
"upstreams": [
{
"dial": "localhost:8080"
}
]
}
],
"match": [
{
"path": ["/api/"]
}
]
},
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "rewrite",
"uri": "/"
}
],
"match": [
{
"method": "get",
"header_regexp": {
"name": "accept",
"pattern": "text/html"
}
}
]
},
{
"handle": [
{
"handler": "file_server",
"root": "/var/www/chain-writter"
}
]
}
]
}
]
}
]
}
]
}
]
}
}
}
}
}
3. The problem I’m having:
when I visit http://host.com/some/route, I will got 404
5. What I already tried:
I am trying to rewrite all get request which accept contains text/html
to /
how can I rewrite all routes to ‘index.html’ or just /