Closed rcknr closed 3 months ago
Thanks so much for this PR! I hope to get to it this week, but if not, It'll be a few weeks before I get back to it. Anyone else is welcome to test it out and weigh in whether it works for you!
Hi @mattstauffer! Thanks for taking care of this. Hope you'll have some time this week.
@mattstauffer any chance for this one to get reviewed?
@rcknr I'm sorry for the delay. It's on my todo list this week.
@mattstauffer Any chance this gets merged?
Thank you so much for your patience!!
Testing:
brew install cloudflared
valet share-tool cloudflared
valet share
Results:
502 Bad Gateway Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared
The CLI logs show:
2024-08-24T20:59:14Z 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 [::1]:443: connect: connection refused" connIndex=0 event=1 ingressRule=0 originService=https://localhost
I'll be testing around to figure out the origin, but just wanted you to see that I am indeed looking at it!
I secured the site and it worked, so I suspect the tunnels either A) require the site to be secured or B) require our code to be a bit smarter depending on whether the site is secured. Will dig into it a bit.
Looks like the new logic around $SECURED
wasn't actually working; it marked every site as secured, rather than assigning $SECURED
the exit code of the command, so we had to refactor that. Also refactored the implementation of the currentTunnelUrl
to be less nested and added a few comments so everything's more clear. But it works now! Thanks for your PR and your patience, @rcknr!
@mattstauffer Thanks for finally finding time to get this merged!
Great PR @rcknr Thanks for passing it through @mattstauffer
After testing it and figuring out how the cloudflare tunnels work, the easiest way to run a private tunnel is to add --name TunnelName after the cloudflared command (valet share).
But cause of the valet bash script stripping any -- arguments from valet share
, it doesn't seem possible without rewriting the $PARAMS handling.
So just as a reference for others, since the readme for cloudflare is quite big.
valet share runs the following:
cloudflared tunnel --no-tls-verify --url "http://localhost" --http-host-header "local-dev.test"
which runs in the trycloudflare.com url mode, to use your own tunnel (after tunnel login + tunnel create + tunnel route) simply append the name
cloudflared tunnel --no-tls-verify --url "http://localhost" --http-host-header "local-dev.test" --name tunnelName
@danijelk Thanks! I have submitted #1495 to fix parameters handling but it wasn't merged yet. It seems to me that Valet is being abandoned which is a pity.
@danijelk Thanks! I have submitted #1495 to fix parameters handling but it wasn't merged yet. It seems to me that Valet is being abandoned which is a pity.
Oh nice, can't speak much for the valet part, but awesome to see people that care still try to help 💪
This adds a new way of sharing websites using
cloudflared
, specifically something called "quick tunnels". These don't require registration and are free of charge to use. It's also possible to use your own domain for sharing by authenticating and configuring a custom tunnel. However, the basic usage requires zero setup.