Skip to content

Proxy graceful error handling misses prefixed route paths (e.g. meta-tr) #639

Description

@felixgabler

Description

The proxy handler's graceful error handling (return 204 on upstream failure) doesn't match prefixed analytics routes like /_proxy/meta-tr.

proxy-handler.ts, catch block:

if(path.includes("/collect")||path.includes("/tr")||path.includes("/events")){event.node.res.statusCode=204;return"";}

The Meta Pixel route is /_proxy/meta-tr/**https://www.facebook.com/tr/**. When the upstream is unreachable, the path /_proxy/meta-tr does not contain the substring /tr (it's -tr), so the check fails and the handler throws a 502 instead of silently returning 204.

Impact

~6K server-side Sentry errors/day from POST /_proxy/meta-tr with "Failed to reach upstream".

Suggestion

Match against the resolved upstream target URL (which does contain /tr) instead of the incoming proxy path. Or match all /_proxy/** routes in the catch block since they're all analytics endpoints.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions