wrangler dev --host param - request for clarification
Closed this issue · 4 comments
This is not really a bug, just request for clarification in the docs.
What exactly is the purpose --host
param in wrangler dev
?
Is it supposed to set the origin behind current worker to the defined host?
Or is it supposed to make wrangler behave as if it is running itself on this host?
--host
allows you to specify the origin your worker would make a request to. So if you set your host to example.com
and then made a fetch in your worker to example.com
, we'd send that request to your origin server, not to the worker a second time.
Thanks for the clarification.
I think explaining this in the docs can benefit everyone.
I believe it is in the docs - do you think the wording could be clearer?
At least for me, the concept of Origin and how Cloudflare DNS works exactly was not 100% clear.
I'm for example using Cloudflare workers to call Google cloud function that has its own address, which is different than the Worker's.
So I wasn't aware that Cloudflare is proxying to an Origin that is on the same domain as the worker. The way that you've explained it here made it clear for me, and perhaps it can help others too.
The docs only tells you that it defines the origin without really explaining what it means.