[GH-ISSUE #93] Automatically reload/refresh inbox in UI #61

Closed
opened 2026-03-15 12:20:50 +03:00 by kerem · 10 comments
Owner

Originally created by @D3strukt0r on GitHub (Apr 18, 2023).
Original GitHub issue: https://github.com/axllent/mailpit/issues/93

The company I work for has recently switched over to your tool, and there is certainly one feature I have been missing, which is that the inbox reloads automatically. If I immediatly saw that a new mail came in, it would hinder my development process less. Maybe make it configurable or something.

Originally created by @D3strukt0r on GitHub (Apr 18, 2023). Original GitHub issue: https://github.com/axllent/mailpit/issues/93 The company I work for has recently switched over to your tool, and there is certainly one feature I have been missing, which is that the inbox reloads automatically. If I immediatly saw that a new mail came in, it would hinder my development process less. Maybe make it configurable or something.
kerem closed this issue 2026-03-15 12:20:55 +03:00
Author
Owner

@axllent commented on GitHub (Apr 18, 2023):

Hi @D3strukt0r. This feature already exists and is always enabled. If I had to take a calculated guess, you are accessing the Mailpit http server via a proxy, an I right (eg: Apache it Nginx)? Can you confirm please, and is so, what proxy are you using?

<!-- gh-comment-id:1513654139 --> @axllent commented on GitHub (Apr 18, 2023): Hi @D3strukt0r. This feature already exists and is always enabled. If I had to take a calculated guess, you are accessing the Mailpit http server via a proxy, an I right (eg: Apache it Nginx)? Can you confirm please, and is so, what proxy are you using?
Author
Owner

@D3strukt0r commented on GitHub (Apr 19, 2023):

@axllent Oh I didn't know that, then I don't know what I am missing. We are using an Nginx Proxy, pretty simple one

docker-compose.yml

services:
  mailcatcher:
    image: axllent/mailpit:latest
    init: true
    container_name: mailcatcher
    domainname: local
    networks:
      - appnetwork
  mailcatcher_https:
    image: nginx:latest
    init: true
    container_name: mailcatcher_https
    ports:
      - '1080:443'
    environment:
      NGINX_PROXY: mailcatcher:8025
    volumes:
      - ./certificates:/etc/ssl/certs/local:ro
      - ../build-local/assets-nginx-https-proxy/default.conf:/etc/nginx/templates/default.conf.template
    links:
      - mailcatcher
    networks:
      - appnetwork

default.conf

upstream upstream {
    server ${NGINX_PROXY};
}

server {
    listen 80 default_server;
    server_name _;

    location / {
        return 302 https://$host$request_uri;
    }
}

server {
    listen 443 ssl http2 default_server;
    server_name _;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    ssl_session_tickets off;
    ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH;
    ssl_certificate /etc/ssl/certs/local/cert.pem;
    ssl_certificate_key /etc/ssl/certs/local/key.pem;

    client_max_body_size 100M;

    location / {
        proxy_pass http://upstream/;

        proxy_redirect off;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $server_name;
    }
}
<!-- gh-comment-id:1514480106 --> @D3strukt0r commented on GitHub (Apr 19, 2023): @axllent Oh I didn't know that, then I don't know what I am missing. We are using an Nginx Proxy, pretty simple one `docker-compose.yml` ```yaml services: mailcatcher: image: axllent/mailpit:latest init: true container_name: mailcatcher domainname: local networks: - appnetwork mailcatcher_https: image: nginx:latest init: true container_name: mailcatcher_https ports: - '1080:443' environment: NGINX_PROXY: mailcatcher:8025 volumes: - ./certificates:/etc/ssl/certs/local:ro - ../build-local/assets-nginx-https-proxy/default.conf:/etc/nginx/templates/default.conf.template links: - mailcatcher networks: - appnetwork ``` `default.conf` ```nginx upstream upstream { server ${NGINX_PROXY}; } server { listen 80 default_server; server_name _; location / { return 302 https://$host$request_uri; } } server { listen 443 ssl http2 default_server; server_name _; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_session_tickets off; ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH; ssl_certificate /etc/ssl/certs/local/cert.pem; ssl_certificate_key /etc/ssl/certs/local/key.pem; client_max_body_size 100M; location / { proxy_pass http://upstream/; proxy_redirect off; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $server_name; } } ```
Author
Owner

@D3strukt0r commented on GitHub (Apr 19, 2023):

@axllent

ok so switched to your own ssl config and works with that. why is that though?

  mailcatcher:
    image: axllent/mailpit:latest
    init: true
    container_name: mailcatcher
    domainname: local
    ports:
      - '1080:8025'
    environment:
      MP_UI_TLS_CERT: /etc/ssl/certs/local/cert.pem
      MP_UI_TLS_KEY: /etc/ssl/certs/local/key.pem
    volumes:
      - ./certificates:/etc/ssl/certs/local:ro
    networks:
      - appnetwork
<!-- gh-comment-id:1514493055 --> @D3strukt0r commented on GitHub (Apr 19, 2023): @axllent ok so switched to your own ssl config and works with that. why is that though? ```yaml mailcatcher: image: axllent/mailpit:latest init: true container_name: mailcatcher domainname: local ports: - '1080:8025' environment: MP_UI_TLS_CERT: /etc/ssl/certs/local/cert.pem MP_UI_TLS_KEY: /etc/ssl/certs/local/key.pem volumes: - ./certificates:/etc/ssl/certs/local:ro networks: - appnetwork ```
Author
Owner

@axllent commented on GitHub (Apr 19, 2023):

I suspect your proxy does not handle websockets properly, though I can't say right now what you need to change as I have a really custom setup that is of no use to you. You probably need to add some section above your location / specifically for the /api/events path:

       location /api/events { 
		... websocket options
	}

       location / {
              ..... 

I think you'll find your answer on Google as it is a common issue with proxies.

<!-- gh-comment-id:1514528926 --> @axllent commented on GitHub (Apr 19, 2023): I suspect your proxy does not handle websockets properly, though I can't say right now what you need to change as I have a really custom setup that is of no use to you. You probably need to add some section above your `location /` specifically for the `/api/events` path: ``` location /api/events { ... websocket options } location / { ..... ``` I think you'll find your answer on Google as it is a common issue with proxies.
Author
Owner

@axllent commented on GitHub (Apr 20, 2023):

The answer to your problem can be found on: https://www.nginx.com/blog/websocket-nginx/

It has to do with the lack of the Upgrade headers in your Nginx configuration.

The WebSocket protocol is different from the HTTP protocol, but the WebSocket handshake is compatible with HTTP, using the HTTP Upgrade facility to upgrade the connection from HTTP to WebSocket.

<!-- gh-comment-id:1515636718 --> @axllent commented on GitHub (Apr 20, 2023): The answer to your problem can be found on: https://www.nginx.com/blog/websocket-nginx/ It has to do with the lack of the `Upgrade` headers in your Nginx configuration. > The WebSocket protocol is different from the HTTP protocol, but the WebSocket handshake is compatible with HTTP, using the HTTP Upgrade facility to upgrade the connection from HTTP to WebSocket.
Author
Owner

@D3strukt0r commented on GitHub (Apr 20, 2023):

Oooh, thanks for sending the article :)

<!-- gh-comment-id:1515867323 --> @D3strukt0r commented on GitHub (Apr 20, 2023): Oooh, thanks for sending the article :)
Author
Owner

@ryssbowh commented on GitHub (Apr 22, 2023):

I'm also struggling setting that up for an Apache server, spent hours trying various vhost config but can't get it to work.
By any chance, do you see anything fundamentally wrong with the following : ?

RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:8025/$1" [P,L]

ProxyPass / http://127.0.0.1:8025/
ProxyPassReverse / http://127.0.0.1:8025/
ProxyRequests Off
ProxyPreserveHost On
<!-- gh-comment-id:1518539920 --> @ryssbowh commented on GitHub (Apr 22, 2023): I'm also struggling setting that up for an Apache server, spent hours trying various vhost config but can't get it to work. By any chance, do you see anything fundamentally wrong with the following : ? ``` RewriteEngine on RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteCond %{HTTP:Connection} upgrade [NC] RewriteRule ^/?(.*) "ws://127.0.0.1:8025/$1" [P,L] ProxyPass / http://127.0.0.1:8025/ ProxyPassReverse / http://127.0.0.1:8025/ ProxyRequests Off ProxyPreserveHost On ```
Author
Owner

@axllent commented on GitHub (Apr 22, 2023):

In one working apache example where I proxy a /mail/ path to Mailpit, I have this (but I'm sure you can adjust accordingly):

    # Upgrade & proxy Mailpit websocket requests
    RewriteEngine On
    RewriteCond         %{HTTP:Connection}      Upgrade [NC]
    RewriteCond         %{HTTP:Upgrade}         websocket [NC]
    RewriteRule         /mail/api/events  ws://localhost:8025/api/events  [P,L]
    ProxyPass           /mail/api/events  ws://localhost:8025/api/events
    ProxyPassReverse    /mail/api/events  ws://localhost:8025/api/events


    # Proxy all other Mailpit requests
    <Location "/mail/">
        ProxyPass "http://localhost:8025/"
        ProxyPassReverse "http://localhost:8025/"
    </Location>
<!-- gh-comment-id:1518576726 --> @axllent commented on GitHub (Apr 22, 2023): In one working apache example where I proxy a `/mail/` path to Mailpit, I have this (but I'm sure you can adjust accordingly): ```config # Upgrade & proxy Mailpit websocket requests RewriteEngine On RewriteCond %{HTTP:Connection} Upgrade [NC] RewriteCond %{HTTP:Upgrade} websocket [NC] RewriteRule /mail/api/events ws://localhost:8025/api/events [P,L] ProxyPass /mail/api/events ws://localhost:8025/api/events ProxyPassReverse /mail/api/events ws://localhost:8025/api/events # Proxy all other Mailpit requests <Location "/mail/"> ProxyPass "http://localhost:8025/" ProxyPassReverse "http://localhost:8025/" </Location> ```
Author
Owner

@ryssbowh commented on GitHub (Apr 23, 2023):

Thanks, that confirms the issue comes from my server somehow, I keep getting a 400.

<!-- gh-comment-id:1518949349 --> @ryssbowh commented on GitHub (Apr 23, 2023): Thanks, that confirms the issue comes from my server somehow, I keep getting a 400.
Author
Owner

@axllent commented on GitHub (Apr 24, 2023):

If you "inspect" the page check check your browser requests, the response text of those requests will likely tell you the cause of the error.

<!-- gh-comment-id:1519204782 --> @axllent commented on GitHub (Apr 24, 2023): If you "inspect" the page check check your browser requests, the response text of those requests will likely tell you the cause of the error.
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#61
No description provided.