Trying to get Cloudflared tunnel working

On my local machine I have Prisma Studio running, on localhost:5555 or 8080 or whatever port desired

# Default to port 5555
npx prisma studio

# set to a particular port
npx prisma studio --port 8080

image

Using the
https://dash.teams.cloudflare.com/ Then > access > tunnels

The tunnel looks correctly set up, points to my IP and has a Connector ID
Public hostname is what I want (test.mydomain.com)
Service is what Prisma is locally https://localhost:8080

However, when I go to the public hostname I get a Cloudflare page, it says error 502 Bad Gateway
page Says:

  • Browser: working
  • Cloudflare: working
  • Host: error

Not sure what I am missing, any info is appreciated

Are you sure it’s HTTPS on localhost?

If so, is there a valid certificate? Since it’s localhost, I’m gonna go with unlikely.

Either use HTTP (HTTPS provides no benefit on localhost to localhost) or set No TLS Verify under the TLS tab in the same place you setup the public hostname.

On the localhost I have a valid cert.pem located in ~/.cloudflared

I detailed those items in this post earlier today, might be related:

Lemme check about the https…

The certificate for cloudflared isn’t the issue, that one is used for cloudflared to speak to Cloudflare’s edge - it’ll access https://localhost:8000 and unless there’s a valid, trusted certificate for localhost then it’ll fail.

But of course, you’re not going to have a valid, trusted certificate for localhost without making a self-signed one and messing around with your device’s certificate authorities.

This is the option you’re looking for.

1 Like

Per your suggestion I did change to http for localhost and now it works!
Yay, thanks

Any idea about that other ticket I linked to above?

The certificate should be generated in ~\.cloudflared\cert.pem after you run cloudflared login - which you should have done unless you’re passing it a set of tunnel credentials generated from another device.

Basically, either you have a cert.pem from logging in or .json credentials from creating that tunnel on a different device.

https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/configuration/arguments/#origincert

Are you mapping your home .cloudflared folder into the Docker container?

I don’t think I’m altering the docker compose for the certificate location, I’ll look for an example of that. But it’s in my root, it’s listed on the search path, but it’s not finding it

We should discuss that ticket over there lol

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