N8N SSL on main domain port:5678

327 Views Asked by At

I have been struggling with getting this n8n port secure with an SSL (https://). My n8n sits on the main root at mydomain.com:5678. I have forced https sitewide but has not worked. I have read many different docs but none seemed to help me with my particular VPS setup. I am semi-new to the VPS space, so keeping it simple to implement would be great.

I do use let's encrypt for the SSL for my domain and docker to do the installation of n8n. My application does run with no issues on HTTP, but not HTTPS.

My VPS Build:

  • CyberPanel Version: 2.3
  • CentOS 7 64bit with CyberPanel
  • Docker version 23.0.1, build a5ee5b1
  • Zend Engine v3.4.0
  • PHP 7.4.33
  • Apache/2.4.6 (CentOS)

I have tried many different fixed but none with my specific setup.

2

There are 2 best solutions below

0
On

Go to listWebsites from CyberPanel, then click on Manage Domain and add this code in vHost Conf

enter image description here

extprocessor n8n {
   type proxy
   address [SERVER IP ADDRESS]:5678
   maxConns 100
   pcKeepAliveTimeout 60
   initTimeout 60
   retryTimeout 0
   respBuffer 0
}

Click Save

Then click on Rewrite Rules, or you can edit the .htaccess file

enter image description here

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule ^(.*)$ http://n8n /$1 [P]
1
On

Installed LiteSpeed Webadmin to reroute proxy to port:5678. Thank he was the fix on the cyber panel.