Skip to content

Issue with oauth2 url callback host when callback-host is set to 0.0.0.0 #10603

@gnekich

Description

@gnekich

What versions & operating system are you using?

OS: Any
Node.js v24.7.0
⛅️ wrangler 4.35.0

Please provide a link to a minimal reproduction

No response

Describe the Bug

The issue we are currently having is with this setting:

--callback-host=0.0.0.0

Currently when working inside Docker container we need to listen for localhost on 0.0.0.0. However, the login and callback urls still need to specify localhost as the host.

Currently, this is not working as setting callback-host=0.0.0.0 also changes the host in login and callback urls to 0.0.0.0 which results in an error and prevents the authorization page from loading.

The current workaround is to manually replace 0.0.0.0 in the login url with localhost and everything works.

Reproduction step can be caused with following command:

npx wrangler login --browser=false --callback-host=0.0.0.0 --callback-port=8976

Workaround is provided by blixt as:

npx wrangler login --browser=false --callback-host=0.0.0.0 --callback-port=8976 | stdbuf -oL sed 's/0\.0\.0\.0/localhost/g'

Ref: #5937 (comment)

In short https://dash.cloudflare.com/oauth2/auth endpoint does not accept 0.0.0.0 as a valid redirect_uri value, causing all the trouble, but still more details can be found in issue #5937 and issue #9065

Fix for this issue by resolving everything on client side in wrangler cli is available in PR #9396
@penalosa

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions