UI Connection Lost - Server-Sent Events


I’m getting this error yet I believe there is connection since the app works just fine when I interact with the UI, change or save something in a workflow.


This is happened after I configured a reverse proxy in front of n8n. Here is the setup:

  • n8n.example.com points to nginx server.
  • NGINX works as reverse proxy on nginx server. listen n8n.example.com 443 and redirects N8NServer:5678
  • n8n container works on N8NServer mapped to 5678:5678

n8n container deployed via docker-composed using below env. variables and using sqllite

  - N8N_PROTOCOL=https
  - N8N_HOST=n8n.example.com
  - VUE_APP_URL_BASE_API=https://n8n.example.com/
  - WEBHOOK_TUNNEL_URL=https://n8n.example.com/

Guess the problem is that the reverse proxy is not configured correctly to work with Server-Sent Events. For that reason do you see this error message. You should find the solution here:

Hello guys…
I’m on this issue “Lost Connection”… but my server is Apache… I’ve make a research and saw it’s very different from nginx configs and didn’t find anything here at community…
Do you have some hint?
Sometimes I get “404 page not found” too… and have to restart n8n…

@simeia sorry have even less knowledge about Apache than Nginx. I can only advise you to check the Nginx settings and then look online for settings in Apache which do the same.

Or you can search generally on Google for “server sent events” and Apache to find a possible configuration.

If none of it works for you I can sadly simply only advice you to use the default configuration with Nginx which can be found in the documentation.

Thanks @jan I’m just doing this…

I have exactly the same setup. Using Caddy v1, the following solution worked:

n8n.example.co.uk {
    proxy / localhost:5678 {

However, I’m migrating to Caddy v2 and can’t seem to get the same to work. My Caddyfile v2 equivalent is:

n8n.example.co.uk {
    reverse_proxy http://localhost:5678

This should work but it doesn’t and for the life of me I cannot work out why

I figured it out how to make it work!

To handle server push event with Caddy (v2) you need to enable flush_interval. My final caddy config looks like this:

n8n.example.com {
  reverse_proxy {
    flush_interval 10

Here’s my environments:

      - N8N_PORT=5678
      - VUE_APP_URL_BASE_API=https://n8n.example.com
      - WEBHOOK_TUNNEL_URL=https://n8n.example.com```
1 Like

Thanks a lot @lokahi for sharing this!