Skip to content

Pulse email links silently break when PUBLIC_APP_URL includes a path — normalize to origin and warn #639

Closed

Description

@gkhngyk

Problem

If PUBLIC_APP_URL is set with a path (e.g. https://app.example.com/dashboard/insights instead of the bare origin), every link in the Daily Pulse email silently breaks: the engine appends its own paths, producing URLs like /dashboard/insights/dashboard/insights for the CTA and /dashboard/insights/dashboard/settings?tab=notifications for the manage-notifications footer link.

This just happened in a real deployment — the emails went out with doubled paths and nothing warned about the misconfiguration.

Evidence

Suggested fix

Normalize in appUrl(): parse the value and use new URL(value).origin (falling back to the raw value if parsing fails), and log a one-time warning when the configured value contains a path so the operator learns their env is off. Keep the localhost default as-is.

Acceptance criteria

  • With PUBLIC_APP_URL=https://app.example.com/some/path, pulse emails link to https://app.example.com/dashboard/insights and a warning is logged at startup or first use.
  • With a correctly configured origin, behavior is unchanged.

Activity

  1. added
    bug
    good first issue
    on Aug 4, 2026
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

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions