Reverse PROXY NGINX Problem

Describe the problem/error/question

Hi i setup n8n running inside docker, and reverse proxy nginx using let’s encrypt.
But when i access n8n direct by ip and port 5678 workflow excute working. But if i access via domain it not working (image)
This is my docker-compose file and setting nginx. I follow all docs nginx in community but i does’nt help.

version: '3'
    image: n8nio/n8n
    container_name: n8n
    restart: always
      - 5678:443
      - N8N_PORT=443
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=
      - ./n8n_data:/home/node/.n8n

Nginx config:

server {
    server_name; # managed by Certbot
        location / {
                proxy_pass http://localhost:5678;
                proxy_set_header Connection '';
                proxy_http_version 1.1;
                chunked_transfer_encoding off;
                proxy_buffering off;
                proxy_cache off;

location ~ ^/(webhook|webhook-test) {
         proxy_set_header Connection '';
        chunked_transfer_encoding off;
        proxy_buffering off;
        proxy_cache off;
        proxy_pass http://localhost:5678;

 client_max_body_size 0;

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
server {
    if ($host = {
        return 301 https://$host$request_uri;
    } # managed by Certbot
        listen 80 ;
        listen [::]:80 ;
    return 404; # managed by Certbot

Hi @dangdh, welcome to the community!

I am sorry you are having trouble.

Starting with version 1, n8n uses websockets to send status updates from the server to the UI. For these to work your nginx config needs a few more tweaks. Check out "Connection Lost" warning - #7 by Valerian_Lebert for an example, from the looks of it I think these two lines need to be added to your server block:

    proxy_set_header Connection 'upgrade';
    proxy_set_header Upgrade $http_upgrade;

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.