[GH-ISSUE #19] Allow Mailpit to run at a non-root app context such as /mailpit/ #18

Closed
opened 2026-03-15 12:07:03 +03:00 by kerem · 7 comments
Owner

Originally created by @dforrest-es on GitHub (Oct 17, 2022).
Original GitHub issue: https://github.com/axllent/mailpit/issues/19

Is there a way to configure an application context? I need to serve Mailpit behind a proxy at https://{hostname}/mailpit/. However, the app artifacts (dist/app.js, etc) do not include that context.

This behavior would be similar to MailHog's MH_UI_WEB_PATH (docs)

Originally created by @dforrest-es on GitHub (Oct 17, 2022). Original GitHub issue: https://github.com/axllent/mailpit/issues/19 Is there a way to configure an application context? I need to serve Mailpit behind a proxy at `https://{hostname}/mailpit/`. However, the app artifacts (`dist/app.js`, etc) do not include that context. This behavior would be similar to MailHog's `MH_UI_WEB_PATH` ([docs](https://github.com/mailhog/MailHog/blob/master/docs/CONFIG.md))
kerem 2026-03-15 12:07:03 +03:00
Author
Owner

@axllent commented on GitHub (Oct 17, 2022):

The artefacts themselves should be relative to the entry point , so this should not be a problem and works fine here (at work we also use it as a virtual subdirectory which is proxies). Have you checked the http requests in your browser's debug tools to see what path it is using for those assets?

<!-- gh-comment-id:1281325794 --> @axllent commented on GitHub (Oct 17, 2022): The artefacts themselves should be relative to the entry point , so this should not be a problem and works fine here (at work we also use it as a virtual subdirectory which is proxies). Have you checked the http requests in your browser's debug tools to see what path it is using for those assets?
Author
Owner

@macau23 commented on GitHub (Oct 28, 2022):

We currently also want to use Mailpit both behind a proxy, and directly.

Previously we used the option -ui-web-path, e.g. -ui-web-path mailpit to do this, but now this no longer works.

<!-- gh-comment-id:1294774632 --> @macau23 commented on GitHub (Oct 28, 2022): We currently also want to use Mailpit both behind a proxy, and directly. Previously we used the option `-ui-web-path`, e.g. `-ui-web-path mailpit` to do this, but now this no longer works.
Author
Owner

@axllent commented on GitHub (Oct 28, 2022):

I don't understand how your proxy is set up. I use one that that is simply like this which works perfectly fine:

    <Location "/mail/">
        ProxyPass "http://localhost:8025/"
        ProxyPassReverse "http://localhost:8025/"
    </Location>
<!-- gh-comment-id:1295325391 --> @axllent commented on GitHub (Oct 28, 2022): I don't understand how your proxy is set up. I use one that that is simply like this which works perfectly fine: ```apache <Location "/mail/"> ProxyPass "http://localhost:8025/" ProxyPassReverse "http://localhost:8025/" </Location> ```
Author
Owner

@macau23 commented on GitHub (Oct 31, 2022):

For us, we need to access the application at http://somehost:8025/mailpit/ (i.e. direct) and http://someproxy/mailpit/ so that does not work.

<!-- gh-comment-id:1296582237 --> @macau23 commented on GitHub (Oct 31, 2022): For us, we need to access the application at http://somehost:8025/mailpit/ (i.e. direct) and http://someproxy/mailpit/ so that does not work.
Author
Owner

@axllent commented on GitHub (Oct 31, 2022):

I have added a --webroot flag for you in v1.2.7

<!-- gh-comment-id:1296817745 --> @axllent commented on GitHub (Oct 31, 2022): I have added a `--webroot` flag for you in v1.2.7
Author
Owner

@dforrest-es commented on GitHub (Nov 5, 2022):

Thank you @axllent, and thanks to @macau23 for explaining our similar use cases. The changes are working well for me.

<!-- gh-comment-id:1304666170 --> @dforrest-es commented on GitHub (Nov 5, 2022): Thank you @axllent, and thanks to @macau23 for explaining our similar use cases. The changes are working well for me.
Author
Owner

@saurabhnanda commented on GitHub (Jan 16, 2025):

thank you @axllent -- came here looking for this exact use-case.

<!-- gh-comment-id:2594926557 --> @saurabhnanda commented on GitHub (Jan 16, 2025): thank you @axllent -- came here looking for this exact use-case.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#18
No description provided.