CF Tunnel Issue Connecting to Private Network
csulit
PROOP

2 years ago

Getting bad gateway error when my CF Tunnel tries to access my backend api running in listd-rest.railway.internal:8080?

error log:

2024-11-06T06:59:15Z ERR error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp [fd12:e0a0:259::92:4b0d:e703]:8080: connect: connection refused" connIndex=3 event=1 ingressRule=1 originService=http://listd-rest.railway.internal:8080

Solved

8 Replies

2 years ago

Check out the template's prerequisites section - https://railway.app/template/cf-tunnel


csulit
PROOP

2 years ago

No good I followed that same error.


2 years ago

Is your service listening on IPv6?


csulit
PROOP

2 years ago

How to check that?

2024-11-06T07:14:00Z INF Updated to new configuration config="{\"ingress\":[{\"hostname\":\"listd-rest.csulit.dev\", \"originRequest\":{}, \"service\":\"http://listd-rest.railway.internal:8080\"}, {\"hostname\":\"listd-imagekit-auth.csulit.dev\", \"originRequest\":{}, \"service\":\"http://imagekit-auth.railway.internal:8080\"}, {\"service\":\"http_status:404\"}], \"warp-routing\":{\"enabled\":false}}" version=2


2 years ago

What kind of app are you wanting to connect to tunnel to?

Additionally, may I ask your usecase for the tunnel?


csulit
PROOP

2 years ago

Bun and hono rest api. This is how I run the app.

function startServer() {
  Bun.serve({
    fetch: app.fetch,
    hostname: env.HOSTNAME, // <- 0.0.0.0
    port: Number(env.REST_PORT), // <- 8080
  });
  console.info(`Bun + hono.js API running in port: ${env.REST_PORT} 🚀`);
}

may I ask your usecase for the tunnel?: So I don't expose the actual API url


2 years ago

You're going to be exposing it though Cloudflare, so why not just add the Cloudflare domain to the service and save yourself the hassle?

Either way, while the template overview does not have instructions for bun and hono, it has an example for node and express that provide sufficient information for you to be able to make the changes needed to your app.


csulit
PROOP

2 years ago

No worries I just use generated domain by railway.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...