1. Caddy version (caddy version
):
2.0.0
2. How I run Caddy:
caddy run
a. System environment:
$ uname -a
Darwin C02ZL0RJLVDN 18.7.0 Darwin Kernel Version 18.7.0: Mon Feb 10 21:08:45 PST 2020; root:xnu-4903.278.28~1/RELEASE_X86_64 x86_64
b. Command:
caddy run
c. Service/unit/compose file:
None
d. My complete Caddyfile or JSON config:
v1 Caddyfile I used and it works well.
:80 {
gzip
log ./access.log
proxy /api/* 127.0.0.1:9005
root ./public
rewrite / {
if {path} not_match ^/api
to {path} /
}
}
v2 Caddyfile I wrote.
:80 {
encode gzip
log {
output file ./access.log
level DEBUG
}
reverse_proxy /api/* 127.0.0.1:9005
@noneapi {
not path /api/*
}
root * public
file_server
rewrite @noneapi /
}
3. The problem I’m having:
After I run caddy run
, I can access the /api/*
correctly, but the other path is not working, the response content is correct, but the content types are wrong.
So any know how can I create a equivalent Caddyfile in v2?
4. Error messages and/or full log output:
caddy run
2020/05/13 07:27:02.999 INFO using adjacent Caddyfile
2020/05/13 07:27:03.002 INFO admin admin endpoint started {"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2020/05/13 07:27:03.003 INFO http server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server {"server_name": "srv0", "http_port": 80}
2020/05/13 15:27:03 [INFO][cache:0xc0008d64b0] Started certificate maintenance routine
2020/05/13 07:27:03.003 INFO tls cleaned up storage units
2020/05/13 07:27:03.003 INFO autosaved config {"file": "/Users/xxxx/Library/Application Support/Caddy/autosave.json"}
2020/05/13 07:27:03.003 INFO serving initial configuration
5. What I already tried:
None