Skip to content

Admin endpoints rejecting localhost:2019 as Host #7587

@louwers

Description

@louwers

Issue Details

According to the documentation:

if the listen address is loopback (e.g. localhost or a loopback IP, or a unix socket) then the allowed origins are localhost, ::1 and 127.0.0.1, joined with the listen address port (so localhost:2019 is a valid origin).

However localhost:2019 is actually rejected with the message

{"error":"host not allowed: localhost:2019"}

So for example this doesn't work:

 curl -v http://localhost:2019/metrics

While this works:

curl -v http://localhost:2019/metrics -H "Host: localhost"

Caddy 2.11.2

{
        metrics {
                per_host
        }

        admin {
                origins localhost
        }
}

Assistance Disclosure

AI not used

If AI was used, describe the extent to which it was used.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions