Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new share tool, cloudflared #1467

Merged
merged 5 commits into from
Aug 25, 2024
Merged

Conversation

rcknr
Copy link
Contributor

@rcknr rcknr commented Jan 7, 2024

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.

@rcknr rcknr marked this pull request as ready for review January 8, 2024 08:59
@mattstauffer
Copy link
Collaborator

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!

@rcknr
Copy link
Contributor Author

rcknr commented Jan 30, 2024

Hi @mattstauffer! Thanks for taking care of this. Hope you'll have some time this week.

@rcknr
Copy link
Contributor Author

rcknr commented Mar 4, 2024

@mattstauffer any chance for this one to get reviewed?

@mattstauffer
Copy link
Collaborator

@rcknr I'm sorry for the delay. It's on my todo list this week.

@rcknr
Copy link
Contributor Author

rcknr commented Jul 30, 2024

@mattstauffer Any chance this gets merged?

@mattstauffer
Copy link
Collaborator

mattstauffer commented Aug 24, 2024

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!

@mattstauffer
Copy link
Collaborator

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.

@mattstauffer
Copy link
Collaborator

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 mattstauffer merged commit 81efb8e into laravel:master Aug 25, 2024
4 checks passed
@rcknr
Copy link
Contributor Author

rcknr commented Aug 25, 2024

@mattstauffer Thanks for finally finding time to get this merged!

@danijelk
Copy link

danijelk commented Oct 3, 2024

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

@rcknr
Copy link
Contributor Author

rcknr commented Oct 4, 2024

@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
Copy link

danijelk commented Oct 4, 2024

@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 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants