I have encountered a problem similar with Can't build with plugins
When I tried to build caddy with the http.cors plugin by following steps (from GitHub - caddyserver/caddy at v1), the cors plugin cannot be compiled in:
- Create a new folder and within a
main.go
file as:
package main
import (
"github.com/caddyserver/caddy/caddy/caddymain"
_ "github.com/captncraig/cors"
_ "github.com/caddyserver/forwardproxy"
)
func main() {
// optional: disable telemetry
// caddymain.EnableTelemetry = false
caddymain.Run()
}
-
Run
go mod init caddy
-
Run
go get -u github.com/caddyserver/caddy
-
Run
go build
After the Caddy binary generated, I ran ./caddy -plugins
and didn’t see the http.cors
plugin listed, however the http.forwardproxy
plugin can be seen.
Now I have no idea the cause is from the Caddy or the http.cors
plugin, so I am asking for help here, any advice would be appreciated. Thanks!