Trying n8n on Railway - webhook not working

I have no idea why, but when testing my webhook with the port number is does not work. If I remove the port number from the URL is does work.

Can anyone tell me know I’m having issues with port number?

Hi Wayne! I would love to help, but you didn’t give us much context to work off. For example, is this n8n cloud or did you deploy your own instance in docker? Are you using a domain or an IP address? If running on docker, did you setup the webhook url correctly with the domain you are using?

As to why you don’t need the port when using n8n and a domain, there are two kinds of servers on the Internet.

  1. Web servers (can only serve HTML pages, usually over port 80)
  2. Application servers (are a special kind of web server which can run multiple applications on multiple ports)

However, there is only one kind of server that can serve pages to your web-browser. It is a web server. That is why, most application servers come with a web-server built in.

Typically, good web applications are deployed in such a way that there is a load-balancer that also acts as a front facing proxy. The proxy then connects you to an application server that is fast enough to serve your requests.

You should never have to see different IP addresses and internal domains and ports when accessing a well-designed application in general. This is how good applications are designed.

However, if you are seeing port numbers on certain websites, it simply means that you are reaching a web-server that is directly facing you and is exposed to the web.

Hope this helps somewhat!

1 Like

ok I’ve deployed via railway using a template. The n8n instance, when creating a webhook, has a port number, for example https://n8n.railway.app:5678/webhook-test/newaccount

when sending a get request to this url via postman, it times out. However, if I removed the port number from the url, it working.

So I don’t understand why n8n is generating a webhook with a port number, if it doesn’t work with the port number?

Ahhh I think I understand, in the n8n app, via railway, you are seeing the port number in the URL copy section for webhooks, which is confusing because it does not work, and to fix it means you have to do an extra step of erasing the port.

More than likely, this is because of an error in how the railway app deployed the docker image. In docker, you can control what shows for the URL in the UI and what works on the backend. That is why without the port it works (as that is what the backend is using) but the frontend of the app was setup incorrectly on the railway side and is showing that extra bit of info.

It should work just fine with the port number removed, but you will need to talk to railway as to why the URLs are being referenced incorrectly.

Do you have a link to the template you used? I suspect the webhook_url is not correctly set.

thanks for the responses all.

here is the image: n8nio/n8n - Docker Image | Docker Hub

That is a docker image, I thought you were using a template? If you are just using the docker image in Railway wihtout anything else did you set the webhook_url environment option?

here is the link to the template - I assumed it pulled from that docker file:

Deploy N8N on Railway | Railway

And no I haven’t set any webhook_url

Hey @Wayne,

It looks like the template is missing the setting so it will default to the host and port, To fix this you will need to add the WEBHOOK_URL environment option to your application.

I don’t have any instructions on how to do this on Railway but I suspect somewhere in the Railway UI there is a place to add them.

You could also create your own template to include it depending on how handy you are with Railway.

1 Like

I’m pretty new to it (and docker, and brand new to n8n, coming from make.com) however, I do know where to add it, that being said, what do I need to add as the value, given I’ll have multiple webhooks?

edit - all good, thank you, working now.

2 Likes

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