mail catcher reverse proxy with Nginx1 min read

We need your support!!
Other Amount:
techrunnr.com:
24-Hour Flash Sale. Courses from just ₹ 490.

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

Prerequisites
    • Nginx
    • mailcatcher
    • If Not installed please go through our blog for mailcatcher: https://www.techrunnr.com/?s=mailcatcher, For Nginx: https://www.techrunnr.com/nginx-source-installation-in-centos/
  • 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

We need your support!!
Other Amount:
techrunnr.com:
#1
#2
#3
Questions Answered
Articles Written
Overall Points

You may also like...

1 Response

  1. Zoltán Müllner says:

    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