diff --git a/plugin/forward/connect.go b/plugin/forward/connect.go index 13631ca89..9dd6ac855 100644 --- a/plugin/forward/connect.go +++ b/plugin/forward/connect.go @@ -66,7 +66,7 @@ func (p *Proxy) connect(ctx context.Context, state request.Request, forceTCP, me if err == io.EOF && cached { return nil, errCachedClosed } - return nil, err + return ret, err } p.updateRtt(time.Since(reqTime)) diff --git a/plugin/forward/truncated_test.go b/plugin/forward/truncated_test.go index 4d8a0a25e..1c9e92a07 100644 --- a/plugin/forward/truncated_test.go +++ b/plugin/forward/truncated_test.go @@ -49,6 +49,9 @@ func TestLookupTruncated(t *testing.T) { if !resp.Truncated { t.Error("Expected to receive reply with TC bit set, but didn't") } + if len(resp.Answer) != 1 { + t.Error("Expected to receive original reply, but answer is missing") + } resp, err = f.Lookup(state, "example.org.", dns.TypeA) if err != nil { @@ -102,6 +105,9 @@ func TestForwardTruncated(t *testing.T) { if !resp.Truncated { t.Error("Expected to receive reply with TC bit set, but didn't") } + if len(resp.Answer) != 1 { + t.Error("Expected to receive original reply, but answer is missing") + } resp, err = f.Forward(state) if err != nil {