diff --git a/proxy/internal/proxy/reverseproxy.go b/proxy/internal/proxy/reverseproxy.go index 72f674c66..8a65c5556 100644 --- a/proxy/internal/proxy/reverseproxy.go +++ b/proxy/internal/proxy/reverseproxy.go @@ -61,7 +61,7 @@ func (p *ReverseProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { requestID := getRequestID(r) web.ServeErrorPage(w, r, http.StatusNotFound, "Service Not Found", "The requested service could not be found. Please check the URL, try refreshing, or check if the peer is running. If that doesn't work, see our documentation for help.", - requestID, web.ErrorStatus{Proxy: true, Peer: false, Destination: false}) + requestID, web.ErrorStatus{Proxy: true, Destination: false}) return } @@ -324,50 +324,50 @@ func classifyProxyError(err error) (title, message string, code int, status web. return "Request Timeout", "The request timed out while trying to reach the service. Please refresh the page and try again.", http.StatusGatewayTimeout, - web.ErrorStatus{Proxy: true, Peer: true, Destination: false} + web.ErrorStatus{Proxy: true, Destination: false} case errors.Is(err, context.Canceled): return "Request Canceled", "The request was canceled before it could be completed. Please refresh the page and try again.", http.StatusBadGateway, - web.ErrorStatus{Proxy: true, Peer: true, Destination: false} + web.ErrorStatus{Proxy: true, Destination: false} case errors.Is(err, roundtrip.ErrNoAccountID): return "Configuration Error", "The request could not be processed due to a configuration issue. Please refresh the page and try again.", http.StatusInternalServerError, - web.ErrorStatus{Proxy: false, Peer: false, Destination: false} + web.ErrorStatus{Proxy: false, Destination: false} case errors.Is(err, roundtrip.ErrNoPeerConnection), errors.Is(err, roundtrip.ErrClientStartFailed): return "Proxy Not Connected", "The proxy is not connected to the NetBird network. Please try again later or contact your administrator.", http.StatusBadGateway, - web.ErrorStatus{Proxy: false, Peer: false, Destination: false} + web.ErrorStatus{Proxy: false, Destination: false} case isConnectionRefused(err): return "Service Unavailable", "The connection to the service was refused. Please verify that the service is running and try again.", http.StatusBadGateway, - web.ErrorStatus{Proxy: true, Peer: true, Destination: false} + web.ErrorStatus{Proxy: true, Destination: false} case isHostUnreachable(err): return "Peer Not Connected", "The connection to the peer could not be established. Please ensure the peer is running and connected to the NetBird network.", http.StatusBadGateway, - web.ErrorStatus{Proxy: true, Peer: false, Destination: false} + web.ErrorStatus{Proxy: true, Destination: false} case isNetTimeout(err): return "Request Timeout", "The request timed out while trying to reach the service. Please refresh the page and try again.", http.StatusGatewayTimeout, - web.ErrorStatus{Proxy: true, Peer: true, Destination: false} + web.ErrorStatus{Proxy: true, Destination: false} } return "Connection Error", "An unexpected error occurred while connecting to the service. Please try again later.", http.StatusBadGateway, - web.ErrorStatus{Proxy: true, Peer: false, Destination: false} + web.ErrorStatus{Proxy: true, Destination: false} } // isConnectionRefused checks for connection refused errors by inspecting diff --git a/proxy/internal/proxy/reverseproxy_test.go b/proxy/internal/proxy/reverseproxy_test.go index db8218df6..b30bb190f 100644 --- a/proxy/internal/proxy/reverseproxy_test.go +++ b/proxy/internal/proxy/reverseproxy_test.go @@ -833,42 +833,42 @@ func TestClassifyProxyError(t *testing.T) { err: context.DeadlineExceeded, wantTitle: "Request Timeout", wantCode: http.StatusGatewayTimeout, - wantStatus: web.ErrorStatus{Proxy: true, Peer: true, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "wrapped deadline exceeded", err: fmt.Errorf("dial: %w", context.DeadlineExceeded), wantTitle: "Request Timeout", wantCode: http.StatusGatewayTimeout, - wantStatus: web.ErrorStatus{Proxy: true, Peer: true, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "context canceled", err: context.Canceled, wantTitle: "Request Canceled", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: true, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "no account ID", err: roundtrip.ErrNoAccountID, wantTitle: "Configuration Error", wantCode: http.StatusInternalServerError, - wantStatus: web.ErrorStatus{Proxy: false, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: false, Destination: false}, }, { name: "no peer connection", err: fmt.Errorf("%w for account: abc", roundtrip.ErrNoPeerConnection), wantTitle: "Proxy Not Connected", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: false, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: false, Destination: false}, }, { name: "client not started", err: fmt.Errorf("%w: %w", roundtrip.ErrClientStartFailed, errors.New("engine init failed")), wantTitle: "Proxy Not Connected", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: false, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: false, Destination: false}, }, { name: "syscall ECONNREFUSED via os.SyscallError", @@ -879,7 +879,7 @@ func TestClassifyProxyError(t *testing.T) { }, wantTitle: "Service Unavailable", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: true, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "gvisor connection was refused", @@ -890,7 +890,7 @@ func TestClassifyProxyError(t *testing.T) { }, wantTitle: "Service Unavailable", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: true, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "syscall EHOSTUNREACH via os.SyscallError", @@ -901,7 +901,7 @@ func TestClassifyProxyError(t *testing.T) { }, wantTitle: "Peer Not Connected", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "syscall ENETUNREACH via os.SyscallError", @@ -912,7 +912,7 @@ func TestClassifyProxyError(t *testing.T) { }, wantTitle: "Peer Not Connected", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "gvisor host is unreachable", @@ -923,7 +923,7 @@ func TestClassifyProxyError(t *testing.T) { }, wantTitle: "Peer Not Connected", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "gvisor network is unreachable", @@ -934,7 +934,7 @@ func TestClassifyProxyError(t *testing.T) { }, wantTitle: "Peer Not Connected", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "standard no route to host", @@ -945,14 +945,14 @@ func TestClassifyProxyError(t *testing.T) { }, wantTitle: "Peer Not Connected", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, { name: "unknown error falls to default", err: errors.New("something unexpected"), wantTitle: "Connection Error", wantCode: http.StatusBadGateway, - wantStatus: web.ErrorStatus{Proxy: true, Peer: false, Destination: false}, + wantStatus: web.ErrorStatus{Proxy: true, Destination: false}, }, } for _, tt := range tests { diff --git a/proxy/web/src/ErrorPage.tsx b/proxy/web/src/ErrorPage.tsx index 63ca99f95..f3fde1213 100644 --- a/proxy/web/src/ErrorPage.tsx +++ b/proxy/web/src/ErrorPage.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import {BookText, RotateCw, Server, Globe, UserIcon, WaypointsIcon} from "lucide-react"; +import {BookText, RotateCw, Globe, UserIcon, WaypointsIcon} from "lucide-react"; import { Title } from "@/components/Title"; import { Description } from "@/components/Description"; import Button from "@/components/Button"; @@ -7,7 +7,7 @@ import { PoweredByNetBird } from "@/components/PoweredByNetBird"; import { StatusCard } from "@/components/StatusCard"; import type { ErrorData } from "@/data"; -export function ErrorPage({ code, title, message, proxy = true, peer = true, destination = true, requestId }: ErrorData) { +export function ErrorPage({ code, title, message, proxy = true, destination = true, requestId }: ErrorData) { useEffect(() => { document.title = `${title} - NetBird Service`; }, [title]); @@ -31,7 +31,6 @@ export function ErrorPage({ code, title, message, proxy = true, peer = true, des