Just spinning - Self hosted instance of n8nio running behind nginx reverce proxy

Describe the issue/error/question

Brand new install via Docker on Digital Ocean Droplet, using an nginx reverse proxy handle security. Set it up to use a subdomain (xxx.mydomain.com). I get spinning wheels when I try to do a simple Start → HTTP Request to https://www.google.com

image

Running with the following:

Just using straight docker. Here is my run command:

docker run -it --rm --name n8n -e VUE_APP_URL_BASE_API="https://n8nio.sillek.com" -e N8N_LOG_LEVEL=debug -e N8N_BASIC_AUTH_ACTIVE="true" -e N8N_BASIC_AUTH_USER="xxxxx" -e N8N_BASIC_AUTH_PASSWORD="xxxxxxxx" -e WEBHOOK_URL="https://n8nio.sillek.com" -p 5678:5678 -v ~/.n8n:/home/node/.n8n n8nio/n8n

For my reverse proxy, the following is in my location:

location / {
                proxy_pass http://localhost:5678;
                proxy_http_version 1.1;
        }

What is the error message (if any)?

No error, but here are the debug statements

2022-02-04T21:57:31.096Z | debug    | Remove editor-UI session {"sessionId":"bqqm3t1p3n5","file":"Push.js"}
2022-02-04T21:57:31.636Z | debug    | Add editor-UI session {"sessionId":"bgzikg83zcq","file":"Push.js","function":"add"}
2022-02-04T21:57:50.029Z | debug    | Wait tracker querying database for waiting executions {"file":"WaitTracker.js","function":"getwaitingExecutions"}
2022-02-04T21:58:12.776Z | debug    | Received child process message of type start for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:12.794Z | verbose  | Initializing n8n sub-process {"pid":21,"file":"WorkflowRunnerProcess.js","function":"runWorkflow"}
2022-02-04T21:58:12.830Z | verbose  | Workflow execution started {"file":"WorkflowExecute.js","function":"processRunExecutionData"}
2022-02-04T21:58:12.835Z | debug    | Start processing node "Start" {"node":"Start","file":"WorkflowExecute.js"}
2022-02-04T21:58:12.836Z | debug    | Received child process message of type processHook for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:12.837Z | debug    | Running node "Start" started {"node":"Start","file":"WorkflowExecute.js"}
2022-02-04T21:58:12.839Z | debug    | Running node "Start" finished successfully {"node":"Start","file":"WorkflowExecute.js"}
2022-02-04T21:58:12.840Z | debug    | Executing hook (hookFunctionsPush) {"executionId":"2","sessionId":"bgzikg83zcq","file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteBefore"}
2022-02-04T21:58:12.841Z | debug    | Start processing node "HTTP Request" {"node":"HTTP Request","file":"WorkflowExecute.js"}
2022-02-04T21:58:12.843Z | debug    | Running node "HTTP Request" started {"node":"HTTP Request","file":"WorkflowExecute.js"}
2022-02-04T21:58:12.844Z | debug    | Send data of type "executionStarted" to editor-UI {"dataType":"executionStarted","sessionId":"bgzikg83zcq","file":"Push.js","function":"send"}
2022-02-04T21:58:12.848Z | debug    | Received child process message of type processHook for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:12.849Z | debug    | Executing hook on node "Start" (hookFunctionsPush) {"executionId":"2","sessionId":"bgzikg83zcq","file":"WorkflowExecuteAdditionalData.js","function":"nodeExecuteBefore"}
2022-02-04T21:58:12.850Z | debug    | Send data of type "nodeExecuteBefore" to editor-UI {"dataType":"nodeExecuteBefore","sessionId":"bgzikg83zcq","file":"Push.js","function":"send"}
2022-02-04T21:58:12.851Z | debug    | Proxying request to axios {"file":"NodeExecuteFunctions.js","function":"proxyRequestToAxios"}
2022-02-04T21:58:12.852Z | debug    | Received child process message of type processHook for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:12.855Z | debug    | Executing hook on node "Start" (hookFunctionsPush) {"executionId":"2","sessionId":"bgzikg83zcq","file":"WorkflowExecuteAdditionalData.js","function":"nodeExecuteAfter"}
2022-02-04T21:58:12.856Z | debug    | Send data of type "nodeExecuteAfter" to editor-UI {"dataType":"nodeExecuteAfter","sessionId":"bgzikg83zcq","file":"Push.js","function":"send"}
2022-02-04T21:58:12.858Z | debug    | Received child process message of type processHook for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:12.859Z | debug    | Executing hook on node "HTTP Request" (hookFunctionsPush) {"executionId":"2","sessionId":"bgzikg83zcq","file":"WorkflowExecuteAdditionalData.js","function":"nodeExecuteBefore"}
2022-02-04T21:58:12.861Z | debug    | Send data of type "nodeExecuteBefore" to editor-UI {"dataType":"nodeExecuteBefore","sessionId":"bgzikg83zcq","file":"Push.js","function":"send"}
2022-02-04T21:58:12.865Z | debug    | Received child process message of type sendMessageToUI for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:12.867Z | debug    | Send data of type "sendConsoleMessage" to editor-UI {"dataType":"sendConsoleMessage","sessionId":"bgzikg83zcq","file":"Push.js","function":"send"}
2022-02-04T21:58:13.066Z | debug    | Running node "HTTP Request" finished successfully {"node":"HTTP Request","file":"WorkflowExecute.js"}
2022-02-04T21:58:13.068Z | verbose  | Workflow execution finished successfully {"file":"WorkflowExecute.js","function":"processSuccessExecution"}
2022-02-04T21:58:13.072Z | debug    | Received child process message of type processHook for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:13.074Z | debug    | Executing hook on node "HTTP Request" (hookFunctionsPush) {"executionId":"2","sessionId":"bgzikg83zcq","file":"WorkflowExecuteAdditionalData.js","function":"nodeExecuteAfter"}
2022-02-04T21:58:13.077Z | debug    | Send data of type "nodeExecuteAfter" to editor-UI {"dataType":"nodeExecuteAfter","sessionId":"bgzikg83zcq","file":"Push.js","function":"send"}
2022-02-04T21:58:13.091Z | debug    | Received child process message of type processHook for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:13.093Z | debug    | Executing hook (hookFunctionsSave) {"executionId":"2","file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
2022-02-04T21:58:13.098Z | debug    | Received child process message of type end for execution ID 2. {"executionId":"2","file":"WorkflowRunner.js"}
2022-02-04T21:58:13.111Z | debug    | Executing hook (hookFunctionsPush) {"executionId":"2","sessionId":"bgzikg83zcq","file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}
2022-02-04T21:58:13.111Z | debug    | Save execution progress to database for execution ID 2  {"executionId":"2","file":"WorkflowExecuteAdditionalData.js","function":"workflowExecuteAfter"}

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

Information on your n8n setup

  • **n8n version: latest
  • **Database you’re using (default: SQLite):SQLite
  • **Running n8n with the execution process [own(default), main]:see above
  • **Running n8n via [Docker, npm, n8n.cloud, desktop app]:Docker

Hey @sillek,

If you pop open the browser dev tools and check the console and network tabs does it show any errors?

Is there a reason why you did not follow our Server Setup guide?
https://docs.n8n.io/getting-started/installation/advanced/server-setup.html#server-setup

It is quite easy to follow and will result for sure in an n8n instance that will work correctly.

Your proxy configuration is for example not set up to work with ServerSent Events. Here is a post that describes what needs to be done:

But again, I advise following our guide!

@Jon and @jan, first, let me say, thank you!

@jan, the reason I didn’t use the Server Setup was because I was installing this on an existing server co-located with some other apps where I use Nginx as a reverse proxy. I, eventually, might setup a separate server and will definitely be looking more into the Server Setup documentaiton.

In any case, the NGinx recommendations recommended in that post worked perfectly and I’m truly enjoying the application.

One question: is the Nginx configuration info in the standard documentation?

1 Like

Hey @sillek,

That is good news, I also didn’t use the standard setup example and instead use nginx for the same reason as you.

The nginx config is not yet in the documentation, it is something I have been meaning to put in a pull request for since I first setup n8n about 6 months ago.

I’d advise clicking the link to your guide! :slight_smile: Does not work.

1 Like

Here you go…

https://docs.n8n.io/hosting/installation/docker/

Thanks but that’s for docker; not for windows and nginx.

1 Like

I got it figured out with the help of:

N8N as a subfolder with nginx - Questions - n8n

and

Nginx configuration - Questions - n8n

I sill recommend you deal with the guides; you can’t be short and direct users to guides that don’t exist.
(No reference to Windows servers; no reference to nginx, no reference to reverse proxy, etc)

Hey @Joel_Samson,

The guide should still exist but it looks like the link has changed and we have not redirected it…. Looking again it is the anchor that has changed the base url does redirect

We don’t officially have an install guide for Windows Server instead we have a more generic guide for Docker and some steps to use npm.

I think we briefly mentioned reverse proxies but there is nothing fully there for nginx specifically but it shouldn’t be any different to configuring any other application.

We are working on improving our documentation all the time though and we have someone working on different deployment guides so it could be that we will have something for nginx soon.

Nice to hear you are up and running though, happy automating :raised_hands::rocket:

1 Like

this nginx config snippet is working for me

    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Upgrade $http_upgrade;

    location ~ ^/rest/push$ {
      proxy_pass http://127.0.0.1:5678;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_read_timeout 36000s;
      chunked_transfer_encoding off;
      proxy_buffering off;
      proxy_cache off;
    }

    location ~ / {
        proxy_pass http://127.0.0.1:5678;
    }