All contributions

maildev/maildev

MailDev

An SMTP server with a web interface for testing email during development.

Language
TypeScript
GitHub stars
6,164
Merged changes
1
Project site
maildev.github.io

What we changed

replaceCidReferences rewrites cid: links to inline attachments onto the real /api/email/:id/attachment/:file route together with the base path, so the URL works at the root and under a subpath.

What this work shows

  • cid: references in HTML email
  • Apps served under a base path
  • Root-relative URLs
What was broken

cid: links led to a route that did not exist

replaceCidReferences rewrote cid: links in the email HTML to /email/:id/attachment/:file. No such route existed, since attachments are served from /api/... under the configured base path.

How we fixed it

A URL with /api and the base path

The URL is now root-relative and includes the base path and /api, so it works at the root and under a subpath such as /mail. A base path of / adds no prefix, and tests also cover base paths given with and without slashes.

#582

Merged change 1

  1. #582 Build CID attachment URLs against the API route and base path Merged 22 September 2026

What it taught us

An app that can run under a subpath must build every URL from the base path, not from the domain root. We test edge cases such as a base path of /, so no //api/... URL appears that a browser would read as another host.

More about this technology: TypeScript, React and Node

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.