Setting up secure HTTPS for local n8n instance?

I’ve been trying to get my local n8n setup to use HTTPS instead of HTTP, but I’m stuck. I added some stuff to my bashrc config file:

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

But when I start n8n, it still shows:

You can now access the editor at:
http://localhost:5678/

It’s not working like I hoped. Anyone know how to make this HTTPS thing happen? I’m pretty new to this, so step-by-step help would be awesome. Thanks!

hey sarahj, i’ve been there! make sure ur actually using the latest n8n version - older ones might not recognize those env vars. also, double-check ur file paths for the SSL key/cert. if that doesn’t work, try setting N8N_PROTOCOL directly when starting n8n, like: N8N_PROTOCOL=https n8n start. good luck!

I’ve been down this HTTPS rabbit hole with n8n too. One thing that tripped me up was forgetting to expose the HTTPS port. Make sure you’re exposing port 5678 for HTTPS traffic in your network settings or firewall.

Also, have you tried running n8n with the --tunnel option? It creates a secure tunnel and gives you a temporary HTTPS URL. It’s not a permanent solution, but it’s great for testing or temporary setups.

If you’re still stuck, check the n8n logs for any SSL-related errors. Sometimes there are cryptic messages there that can point you in the right direction.

Lastly, if all else fails, consider using a reverse proxy like Nginx. It can handle the SSL termination, allowing you to run n8n internally on HTTP while presenting HTTPS to the outside world. It’s a bit more complex to set up, but it’s a solid long-term solution.

I encountered a similar issue when setting up HTTPS for my local n8n instance. One crucial step that’s often overlooked is restarting the n8n service after modifying the environment variables. Simply updating the bashrc file isn’t sufficient; you need to either restart your terminal session or run ‘source ~/.bashrc’ to apply the changes.

Additionally, ensure your SSL certificate and key files have the correct permissions. n8n needs read access to these files. You can verify this by running ‘ls -l’ on the file paths you’ve specified.

If you’re still facing issues, consider using the n8n configuration file instead of environment variables. Create a ‘.env’ file in your n8n root directory and add the HTTPS settings there. This approach often proves more reliable for persistent configurations.