英文:
Specify jwt token when fetch profile via "go tool pprof"
问题
我的 API 是通过 JWT 进行保护的,是否可以在使用 go tool pprof
获取个人资料时指定一个 JWT 令牌?
目前,我必须配置 JWT 中间件来绕过 /debug/pprof
路由。
英文:
My api is protected via jwt, is it possible to specify a jwt token when fetch profile via go tool pprof
?
Currently, I have to config jwt middleware to bypass the /debug/pprof
routes.
答案1
得分: 2
我找不到直接通过go tool pprof
传递令牌的方法,但由于你可以使用curl
来获取配置文件,有一个简单的解决方法:
$ curl -o profile.out https://host/debug/pprof -H 'X-Authorization: $TOKEN'
$ go tool pprof profile.out
英文:
I couldn't find a way to pass a token via go tool pprof
directly, but due to the fact that you can use curl
to fetch the profile, there is a simple workaround:
$ curl -o profile.out https://host/debug/pprof -H 'X-Authorization: $TOKEN'
$ go tool pprof profile.out
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论