我在使用卡迪v2时遇到了麻烦,而在v1我从来没有遇到过这样的麻烦。
我想优先考虑:
file_server if started with /upload/*
reverse_proxy to 127.0.0.1:9090 if started with /api/*
else reverse_proxy to 127.0.0.1:3000但是似乎我无法使用v2使它正常工作,我已经尝试了很多次(使用matcher,因为127.0.0.1总是404,但是localhost没有,等等),但是似乎127.0.0.1:3000总是优先而不是file_server,即使文件存在,因为它有通配符?
{
debug
auto_https off
log {
output stdout
level DEBUG
}
local_certs
}
127.0.0.1:80, localhost:80 {
root ./svelte/dist
file_server /upload/* browse
reverse_proxy /api/* 127.0.0.1:9090
reverse_proxy * 127.0.0.1:3000
}发布于 2021-08-21 17:30:16
不介意,得到答案了,https://caddy.community/t/v2-hard-to-make-it-right/13394/2
127.0.0.1, 127.0.0.1:80, localhost, localhost:80 {
handle /upload/* {
root ./svelte/dist
file_server browse
}
handle /api/* {
reverse_proxy 127.0.0.1:9090
}
handle {
reverse_proxy 127.0.0.1:3000
}
}https://stackoverflow.com/questions/68875283
复制相似问题