【发布时间】:2013-05-29 02:31:01
【问题描述】:
Go 的默认 HTTP 服务器实现在 HTTP 请求中合并斜杠,将 HTTP 重定向响应返回到“清理”路径:
https://code.google.com/p/go/source/browse/src/pkg/net/http/server.go#1420
因此,如果您发出 HTTP 请求 GET /http://foo.com/,服务器将响应 301 Moved Permanently ... Location: /http:/foo.com/。
我想禁用此行为并自己处理所有路径。
我是 Go 新手,似乎可以创建自己的 Server 实例并覆盖 Handler 属性,但我不知道该怎么做?
【问题讨论】: