Hello, I really need some help accessing my app via cloudfared tunnel. The app is installed on an AWS EC2 Debian machine. I can successfully hit the page using http://[EC2IP]:[port] configured via inbound security rules. I can also successfully setup the cloudflare tunnel and access it via that tunnel and my personal domain and CNAME, but ONLY if I expose all TCP ports for 0.0.0.0/0. Otherwise Cloudflare cannot access the application. I have tried adding the public cloudflare ipv4 ranges (https://www.cloudflare.com/ips/) to the inbound rules, but that does not work either. Can anyone help with this?

EDIT: got it to work! Thank you so much @lilshalom@Lemmylefty@lemmy.world and @voidx@futurology.today !!

@voidx@futurology.today
link
fedilink
English
1
edit-2
1Y

Cloudflare tunnel only requires outbound port opened, check if you’ve allowed all outbound ports in EC2 security group (the default VPC should have this already).

Otherwise it’s probably a misconfiguration reaching the IP/port of the cloudflared service on the EC2. Have you tried checking cloudflared logs? Does your tunnel status show up as healthy?

He mentioned he was looking at cloudflare logs. So its making an out bound tunnel and when the ec2 firewall is on it doesnt make a connection. If its an outbound tcp connection he should still be able to do a packet capture and see if the handshake is being performed.

chandz05
creator
link
fedilink
English
11Y

Yep all outbound ports are opened, per default. Tunnel does show as healthy in the dashboard. The cloudflared logs say the tunnel is established correctly but cloudflared cannot reach the application. I only have my home IP address set on inbound for both ssh as well as the application and port I’m trying to access. I’ll look into this into more detail again in a couple hours and look at your and lilshalom’s suggestions

@voidx@futurology.today
link
fedilink
English
11Y

Did you get it to work?

chandz05
creator
link
fedilink
English
21Y

OMG I figured it out. It was actually my last comment that got me thinking in the right direction. The problem was that I was using the EC2 public IP address to point the tunnel to. EC2 also has an internal private IP address. Switched the tunnel to point to that, and it works! I felt like such a dummy when I thought about it. The tunnel is trying to hit the app internally. Why would it need to go out to the internet and retrieve a firewalled public address? Seems so obvious now.

@voidx@futurology.today
link
fedilink
English
21Y

Happens to the best of us! localhost or 127.0.0.1 should work too.

chandz05
creator
link
fedilink
English
21Y

I’ve always personally hated localhost and just opt to use the IP directly, which I guess was my downfall this time :)

chandz05
creator
link
fedilink
English
11Y

Not yet. I did a fresh install on a new EC2 server. Cloudflare tunnel seems to be connected correctly i.e. the handshake is successful, and when I hit the URL, I get the cloudflare 404 page that shows the app is down. @lilshalom (is that how you tag in Lemmy?) I’m having trouble figuring out EC2 logs - I’m pretty new to AWS. But I’m pretty confident at this point that the tunnel is setup correctly, but for some reason, it cannot connect to the app. For what it’s worth, I did have it all working on my local raspberry pi. I’ll tinker a bit more and then I’ll probably try the app’s GitHub issues page and see if the dev can chime in

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 125 users / day
  • 420 users / week
  • 1.16K users / month
  • 3.85K users / 6 months
  • 1 subscriber
  • 3.68K Posts
  • 74.2K Comments
  • Modlog