How to change localhost:5678 from webhook url?

Hello!
I’m new to n8n and I’m facing a difficult problem, I’ve looked for a solution in several places but I haven’t found it.
I’m doing the following installation:

In the same docker I installed nginx.
The n8n worked, accessing the valid address through the web, but when I generate a webhook, it comes with the address of (http://localhost:5678/webhook-test/52e34757-c9e4-4d1e-ba05-71f46cf20dd9).
I need to change the url localhost:5678 to my website address.
I don’t know what else to do, I really need the help of colleagues to solve this problem.

Thank you very much!

Best regards,
Charles Leal

Welcome to the community @charlesleal!

That can be configured with the environment variable WEBHOOK_URL as documented here:

Apart from that, I also strongly recommend not using MariaDB or MySQL, as support will be dropped soon. Please use PostgresDB instead.

2 Likes

Hello Jan!
Thanks a lot for the help!
I’m using n8n through docker.
I tried running this command inside the n8n container and it had no effect.
What must I be doing wrong?
Regarding Mariadb, thank you for the tip and could you kindly point me to a tutorial on n8n with postgree, as I use docker with nginx.
Gratitude!

1 Like

Can you please

  • let us know which command you ran?
  • Also when you say “Inside” container. thought you are using docker, and you run the command by passing environment variable in -e WEBHOOK_URL format to it? So much better if you can share your entire command you ran

Hello Getk!
Thank you very much for your attention.

The command I run is export WEBHOOK_URL=https://n8n.example.com/, and instead of the domain I used mine, and it had no effect.
I realized that when I leave the container, everything goes back to how it was before.
Also add the following variables:
N8N_PROTOCOL=https
N8N_HOST=n8n.example.com

Thank you very much!

Hello @charlesleal
Just run new instance of a container, with the same run command as you run in-before, but this time pass WEBHOOK_URL as described here

using -e flag.
And I also strongly recommend to use PostgreSQL.

Before experimenting with anything, If you already have some workflows, you should export and save them.
You can export them using CLI

Hello inbsp!
Forgive my ignorance, because I’m still starting and the only file I executed was the docker-compose.yml from this link:

I’m still not sure which commands I should run.
Please could you tell me because the link you gave me has a lot of information that I still don’t understand.
Thank you very much!

Hmm, at this point, I am not sure what would be the best for you, but here what would I do:

  1. From your link there is an n8n with PostgreSQL at the neighbor folder. Clone this one to the server: n8n/docker/compose/withPostgres at master · n8n-io/n8n · GitHub
  2. Change usernames and passwords in .env file accordingly
  3. Add - WEBHOOK_URL=https://your domain name to the environment: section of the n8n service in docker-compose.yml file
  4. Remove --tunnel part of the start command n8n start --tunnel in docker-compose.yml file
  5. run
docker-compose up -d

and you can stop it with

docker-compose stop
1 Like

Hello!

First I want to thank everyone who took the time to help me here on the forum.
And I also want to say that I solved it just by inserting the variables in the docker-compose.yml file in the correct order and without spaces, as I didn’t have the slightest idea of ​​these necessary criteria.
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/

And in the .env file, I configured the variables:

The top level domain to serve from, this should be the same as the subdomain you created above

DOMAIN_NAME=mydomain.com

The subdomain to serve from

SUBDOMAIN=mysubdomain

Then I ran docker compose up -d, and voila, it worked perfectly!

Thank you very much!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.