From 17a7c3a67870c73af6d1556ffafc57c2489cd4c4 Mon Sep 17 00:00:00 2001 From: zach Date: Sat, 25 Feb 2023 09:26:17 +0800 Subject: [PATCH] feat: add check redirect for identifier request --- nip05/nip05.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nip05/nip05.go b/nip05/nip05.go index 52eadfd..e5cff9c 100644 --- a/nip05/nip05.go +++ b/nip05/nip05.go @@ -37,8 +37,12 @@ func QueryIdentifier(fullname string) *nostr.ProfilePointer { if strings.Index(domain, ".") == -1 { return nil } - - res, err := http.Get(fmt.Sprintf("https://%s/.well-known/nostr.json?name=%s", domain, name)) + client := &http.Client{ + CheckRedirect: func(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse + }, + } + res, err := client.Get(fmt.Sprintf("https://%s/.well-known/nostr.json?name=%s", domain, name)) if err != nil { return nil }