Skip to content

Option to enable trusted_proxies for unix socket files #7263

@cseufert

Description

@cseufert

Issue Details

I am proposing adding a new option to caddy server to enable trusting a connection via a unix socket, to set remote address/port/etc based on X-Fordwarded-For.

I was thinking something like:
{ server { trusted_proxies_unix } } ...

The implementation should be fairly simple, and ideally should be able to also work with trusted_proxies static.

Another options would be some sort of magic value for IP, like ::1 or even ::2 work, or require both 127.0.0.1 and ::1 to be present in trusted proxies.

Currently I am having to replicate the x-forwarded-for behavior using alternative header names, with the following setup:
public:443 -> caddy -> (unix sock) -> caddy -> php_fastcgi
as the Remote IP is lost in this chain.

Assistance Disclosure

AI used

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

Copilot was used to check my suspicions that a unix socket remote address always returns false to trusted remotes

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