#4127·hydra

Support localhost redirection with arbitrary port

Author: ston1thCreated Sep 9, 2026Updated Sep 9, 2026
Labelsfeat

Preflight checklist

Ory Network Project

No response

Describe your problem

In #1732 127.0.0.1 and [::1] were implemented to allow the usage of arbitrary ports.

Many MCP clients like claude code and others do not use 127.0.0.1 but localhost and generate a random port for the OAuth callback. See this commit message: https://github.com/agentserver/agentserver/commit/ff15f32239634e0b30daeddd8553989331586b8a

The MCP context possibly also relates to #4061

Describe your ideal solution

Could you please add localhost as a third allowed option alongside 127.0.0.1 and [::1] to use an arbitrary port.

I know, the RFC does not recommend doing this but there are many usecases that unfortunatly require it anyway: https://datatracker.ietf.org/doc/html/rfc8252#section-8.3

Other OAuth implementations e.g. Microsoft Entra ID do support it. Also there are WSL (Windows Subsystem for Linux) network configurations that do only work using localhost and do not work with 127.0.0.1.

Workarounds or alternatives

None.

Version

v26.0.2

Additional Context

No response