mail catcher reverse proxy with Nginx1 min read

Hi All, this document deals with how to set up mail catcher reverse proxy with Nginx.

    • Nginx
    • mailcatcher
    • If Not installed please go through our blog for mailcatcher:, For Nginx:
  • Now start the mailcatcher service
    mailcatcher --smtp-ip <IPaddress> --http-ip <IP-address> &

    mailcatcher listens 1080(http), 1025(smtp) port number

  • For mailcatcher GUI mode, open your browser and http://<IP>:1080
  • Setup Nginx as a reverse proxy for mailcatcher, Go to Nginx conf file (/etc/nginx/nginx.conf) to add below content to the conf file
    location /mail {
    		proxy_pass http://<IP>:1080/;
    		proxy_http_version 1.1;
    		proxy_set_header Upgrade $http_upgrade;
    		proxy_set_header Connection "upgrade";
    		proxy_read_timeout 1d;
    		sub_filter 'src="/'     'src="/mail/';
    		sub_filter 'href="/'    'href="/mail/';
    		sub_filter 'url(/'      'url(/mail/';
    		sub_filter '"/messages' '"/mail/messages';
    		sub_filter_types text/html text/css application/javascript;
    		sub_filter_once off;
  • Restart the Nginx service
    systemctl restart nginx
  • To verify the mailcatcher reverse proxy configuration with the nginx, Go to your browser  http://<IP>/mail

© 2019, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points

Related posts

One Thought to “mail catcher reverse proxy with Nginx”

  1. Zoltán Müllner

    Mailcatcher uses websockets, so for attachments to work, you also need to filter application/json content:

    sub_filter_types text/html text/css application/javascript application/json;

Leave a Reply