diff --git a/main.go b/main.go index f5f3987..202f32c 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "context" "github.com/cloudwego/hertz/pkg/app" "github.com/cloudwego/hertz/pkg/app/server" + "github.com/cloudwego/hertz/pkg/common/hlog" "strings" ) @@ -31,7 +32,9 @@ func main() { } } } + oldURL := scheme + "://" + host + string(c.Request.RequestURI()) newURL := scheme + "://" + newHost + string(c.Request.RequestURI()) + hlog.Infof("Redirecting from %s to %s", oldURL, newURL) c.Redirect(301, []byte(newURL)) c.Abort() return