Setting up secure HTTPS for local n8n instance?

I’m trying to configure my local n8n setup to use HTTPS instead of HTTP. I’ve added some config options to my bashrc file:

export N8N_PROTOCOL="https"
export N8N_SSL_KEY="/my/key/location"
export N8N_SSL_CER="/my/cert/location"

But when I launch n8n, it still shows:

Editor can be accessed at:
http://localhost:5678/

What am I missing? How can I get n8n to use HTTPS locally? Any tips would be really helpful!

I’ve gone through this process recently, and there are a few things to consider. First, make sure you’re using a recent version of n8n, as older versions might not support HTTPS out of the box.

Another thing to check is whether your SSL certificate is self-signed. If it is, you might need to add the N8N_SSL_REJECT_UNAUTHORIZED=false environment variable to your configuration. This tells n8n to accept self-signed certificates.

Also, don’t forget to update your browser settings. Some browsers block self-signed certificates by default, so you might need to add an exception for your local n8n instance.

Lastly, if you’re using Docker, ensure you’re mapping the correct ports and volumes for your SSL certificates. It took me a while to figure out that my cert files weren’t accessible from within the container.

Hope this helps you get your local n8n instance running securely!

hey tom, i had this issue too. make sure ur using the latest n8n version. also, try running n8n with the --tunnel flag. it creates a secure tunnel automatically. like this:

n8n start --tunnel

this worked for me without messing with certs. give it a shot!

I encountered a similar issue when setting up HTTPS for my local n8n instance. The environment variables you’ve set look correct, but n8n might not be picking them up. Try explicitly passing these options when starting n8n instead:

n8n start --ssl-key=/my/key/location --ssl-cert=/my/cert/location

This forces n8n to use the SSL key and certificate. Also, ensure your cert files have the correct permissions and are readable by the user running n8n. If it still doesn’t work, double-check your cert files are valid and haven’t expired. You might also need to restart your terminal or logout/login for environment variable changes to take effect if you’re using bashrc.