Skip to content

blog post on using a cloudflare worker to xdebug a live hit locally#609

Open
hanoii wants to merge 5 commits intoddev:mainfrom
hanoii:20260407_hanoii_cloudflare_worker_ddev
Open

blog post on using a cloudflare worker to xdebug a live hit locally#609
hanoii wants to merge 5 commits intoddev:mainfrom
hanoii:20260407_hanoii_cloudflare_worker_ddev

Conversation

@hanoii
Copy link
Copy Markdown
Contributor

@hanoii hanoii commented Apr 11, 2026

This is my first attempt at a blog post, not sure if it's useful, interesting or even well written, but gave this a try.

It is AI assisted

Rendered at https://pr-609.ddev-com-fork-previews.pages.dev/blog/cloudflare-workers-live-requests-on-your-local/

@github-actions
Copy link
Copy Markdown

🌐 Fork Preview for PR #609

https://pr-609.ddev-com-fork-previews.pages.dev

This preview updates automatically when you push changes to your fork.

@rfay
Copy link
Copy Markdown
Member

rfay commented Apr 11, 2026

Yay!

@rfay
Copy link
Copy Markdown
Member

rfay commented Apr 14, 2026

@hanoii
Copy link
Copy Markdown
Contributor Author

hanoii commented Apr 15, 2026

I did that for my own use case, the stable domain, I didn't want to overcomplicate the blog post... there is one thing that that I also did which was to add the live domain as a fqdn to ddev so everything internal to drupal was as it the host were the live one too:

ddev share --provider=cloudflared --provider-args="--http-host-header demo.devhosting.com.ar --hostname ddev.devhosting.com.ar"

Might add this though.

@hanoii
Copy link
Copy Markdown
Contributor Author

hanoii commented Apr 15, 2026

I had to run ddev non-interactively, so that it doesn't prompt me to update /etc/hosts with the fqdn to localhost, which obviously I didn't want that to happen

@hanoii
Copy link
Copy Markdown
Contributor Author

hanoii commented Apr 15, 2026

Other than that any other feedback? Would you publish it as is?

@rfay
Copy link
Copy Markdown
Member

rfay commented Apr 15, 2026

I had to run ddev non-interactively, so that it doesn't prompt me to update /etc/hosts with the fqdn to localhost, which obviously I didn't want that to happen

Interesting problem. DDEV tries to add to hosts file when the domain can't be looked up, or when it doesn't evaluate to 127.0.0.1. I thought that when I tested this earlier I didn't see problems like this.

Other than that any other feedback? Would you publish it as is?

I want to walk through and manually test. I'm sure @stasadev will have some input as well.

I would like a better title. "Using Cloudflare Workers to tunnel matching traffic into your local" doesn't mention DDEV and doesn't really say what the goal is. I think the goal is using Xdebug to debug an internet-exposed service that happens to be your local DDEV project.

IMO the stable subdomain would simplify this article, rather than making it more complex, because right now you have to go figure out what domain you're auto-assigned and fiddle with things. Maybe that happens anyway, not sure.

I'm also not sure why you have to do any of the cloudflare worker stuff if you have ddev share with a stable domain.

@hanoii
Copy link
Copy Markdown
Contributor Author

hanoii commented Apr 15, 2026

I'm also not sure why you have to do any of the cloudflare worker stuff if you have ddev share with a stable domain.

Even with this, the share would be a tunnel, I can't tunnel to a domain that's already pointing somewhere else. The worker also has logic to only tunnel very specific traffic.

@hanoii
Copy link
Copy Markdown
Contributor Author

hanoii commented Apr 15, 2026

Interesting problem. DDEV tries to add to hosts file when the domain can't be looked up, or when it doesn't evaluate to 127.0.0.1. I thought that when I tested this earlier I didn't see problems like this.

Yes, I found it odd and wondered if there was a setting to avoid this. I looked at the code and that's where I noticed this wouldn't happen if called non-interactively.

https://github.com/ddev/ddev/blob/4c4462078299db2e2baa1a1a1884bdc981c6ef17/pkg/ddevapp/hostname_mgt.go#L26-L28

@hanoii
Copy link
Copy Markdown
Contributor Author

hanoii commented Apr 15, 2026

And is not just publishing a live domain, is actually hijacking the live domain.

Say that you want to debug something hitting ddev.com, but on your local. This is what I am doing.

@rfay
Copy link
Copy Markdown
Member

rfay commented Apr 15, 2026

Say that you want to debug something hitting ddev.com, but on your local. This is what I am doing.

I would normally debug it on xxx.ddev.com or some such. it's usually the TLD that is the issue with things like this.

@hanoii
Copy link
Copy Markdown
Contributor Author

hanoii commented Apr 15, 2026

but that's the thing with the article, saml was hitting ddev.com, and changing that was what I wanted to avoid.

I was looking to debug a hit in the ddev.com not change that. Doing a subdomain that would simply mean using the tunnel. So this is not about using a stable subdomain with cloudflare tunnels, or ngrok which I already had it.

@stasadev stasadev self-requested a review April 16, 2026 09:12
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.

2 participants