我正在使用Caddy提供SSL/HTTPS,然后向运行在各种本地端口上的各种网站/服务器(主要是码头容器)反向代理各种url子目录。
所以:
https://example.org goes to localhost
https://example.org/calendar goes to localhost:8090
https://example.org/address goes to localhost:8091
https://example.org/files goes to localhost:8092等等。
然而,一些站点/服务假设它们驻留在根域中,并且使用绝对的index.html,所以当所有子目录/应用程序都在运行CSS页面时,指向css等的链接都被路由到example.org/css等,而不是example.org//css。
我想避免编辑所有的html/应用程序或使用子域而不是子目录.
有什么办法能让我避开这个问题吗?
发布于 2022-01-03 00:08:06
您可以使用模式匹配来完成这一任务。下面是一个示例caddy配置文件:
example.org {
reverse_proxy / localhost
reverse_proxy /calendar/* localhost:8090
reverse_proxy /address/* localhost:8091
reverse_proxy /files/* localhost:8091
}您可以在这里找到更多详细信息:https://caddyserver.com/docs/caddyfile/matchers
https://stackoverflow.com/questions/70506306
复制相似问题