I’m trying to setup basic auth as described in manual: https://docs.n8n.io/reference/security.html
There are no problems running n8n directly but when I use pm2 to start it, main page is open and basic auth simply does not work. I’ve tried to pass env variables to pm2 but still no success. Are there any n8n specific configuration file where I can enable auth or another way how to use pm2 with variables that n8n will handle?
Welcome to the community
I am no expert with PM2 and I have a very limited knowledge. However, a quick search on the internet and I learned that you have to combine the pm2 command when you are declare the variables (I might be wrong). Here are a few links that might help:
I’m not sure why I didn’t read pm2 documentation carefully lazy me But anyway thank you for links.
The second one help me. What I needed to do was:
N8N_BASIC_AUTH_ACTIVE=true N8N_BASIC_AUTH_USER=user N8N_BASIC_AUTH_PASSWORD=pass pm2 restart n8n --update-env
Now it works even after restart.
Awesome! I am glad that it worked out! Thanks for sharing the solution