Setting up secure HTTPS connection for local n8n instance

I’ve been trying to configure my local n8n setup to use HTTPS instead of HTTP. I added some environment variables to my bashrc file:

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

But when I launch n8n, it still shows:

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

It’s still using HTTP. What am I missing? How can I get n8n to use HTTPS locally? I’m new to this and could use some guidance on setting up a secure connection for testing. Thanks for any help!

I encountered a similar issue when setting up HTTPS for my local n8n instance. The environment variables you’ve set look correct, but they might not be taking effect. Try exporting them directly in your terminal before starting n8n:

export N8N_PROTOCOL=“https”
export N8N_SSL_KEY=/my/key/location
export N8N_SSL_CERT=/my/cert/location

Note that it’s N8N_SSL_CERT, not N8N_SSL_CER. Also, ensure your key and cert files have the correct permissions. If it still doesn’t work, you might need to restart your terminal or even your system for the changes to take effect.

Another approach is to use the --ssl-key and --ssl-cert flags when starting n8n:

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

This should force n8n to use HTTPS. Remember to trust the self-signed certificate in your browser when accessing the editor.

Hey there, I’ve been through the HTTPS setup process with n8n and it can be a bit tricky. One thing that helped me was double-checking the file paths for the SSL key and certificate. Make sure they’re absolute paths and the files actually exist where you think they do.

Also, have you tried running n8n with the --tunnel flag? It creates a secure tunnel and gives you a temporary HTTPS URL. It’s super handy for testing:

n8n start --tunnel

This way, you don’t have to mess with SSL certificates locally. It’s been a lifesaver for me during development.

If you’re set on using local HTTPS, you might want to look into using mkcert to generate valid local certificates. It makes the whole process much smoother. Good luck with your setup!

yo sophiac, i had the same headache. try this:

n8n start --ssl-key=/path/to/key.pem --ssl-cert=/path/to/cert.pem

make sure ur paths r correct. if it still acts up, check if ur firewall’s blocking port 5678. sometimes that’s the culprit. good luck!