mailpit: Support Request: White screen and console errors for web UI
The issue
I’m trying to replace Mailhog with Mailpit. I installed it using the script.
sudo bash < <(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh)
I followed the steps here for how to enable Mailpit as a service. Honestly, this should be added to the Wiki.
Then, after stopping Mailhog and starting the Mailpit service (which starts successfully) and visiting the UI, I get these errors in the browser console, and I only see a white screen.
Refused to apply style from 'https://myweburl.example.com/dist/app.css?v1.9.2' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
GET https://myweburl.example.com/dist/app.js?v1.9.2 net::ERR_ABORTED 404 (Not Found)
Refused to execute script from 'https://myweburl.example.com/dist/app.js?v1.9.2' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
GET https://myweburl.example.com/favicon.svg 404 (Not Found)
I don’t know where those files are on the system, or how I need to configure Mailpit or Nginx to get them to load.
Sending mail works (I think). I don’t see any errors when I send a test email.
Configuration info
PHP-FPM
The PHP config:
php_admin_value[sendmail_path] = /usr/local/bin/mailpit sendmail -t test@myweburl.example.com
In the above, I basically just replaced mailhog
with mailpit
.
Nginx
## Mailpit
location ^~ /mailpit/ {
proxy_pass http://localhost:8025/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Client-Verify SUCCESS;
proxy_set_header X-Client-DN $ssl_client_s_dn;
proxy_set_header X-SSL-Subject $ssl_client_s_dn;
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
chunked_transfer_encoding on;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_redirect off;
proxy_buffering off;
}
System info
- Ubuntu 20.04
- Nginx 1.18.0
- PHP 8.2
- Mailpit 1.9.2
Other notes
This issue looks similar to this one, but it’s not exactly the same: https://github.com/axllent/mailpit/issues/137
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 15 (5 by maintainers)
I basically converted to Mailpit because DDEV did so, and then I saw how much greater than Mailhog it is. Thanks for your work to create this wonderful tool!
Yes! @ulken, that fixed it!
I’m not 100 % sure, but I had the same problem earlier today. First missing setting the web root, then 404:ing. My problem was I stripped
/mailpit
from the URL after the proxy handled it. I think you’re doing the same thing. Try appending/mailpit
toproxy_pass
.I see you are routing
/mailpit/
to Mailpit via nginx, but did you set the Mailpit webroot to that too when you started it via your service? If not, then try adding a--webroot /mailpit/
to the ExecStart command to the existing line and see if that works?I’ll definitely consider adding that systemd config to the wiki.