Skip to content

Added support X-Forwarded-Prefix+TrustedProxies#342

Merged
alexjustesen merged 6 commits intoalexjustesen:mainfrom
alexdelprete:xfw-prefix
Jan 28, 2023
Merged

Added support X-Forwarded-Prefix+TrustedProxies#342
alexjustesen merged 6 commits intoalexjustesen:mainfrom
alexdelprete:xfw-prefix

Conversation

@alexdelprete
Copy link
Contributor

The X-Forwarded-Prefix was not configured to be used. Added it in $headers.

I also introduced a variable TRUSTED_PROXIES that should be an array of proxies that user can configure to be trusted. If the variable is not configured, the default is '*' which means any proxy will be trusted.

The use of this variable has to be validated because it should be an array, but we want users to only specify a comma-separated list of IPs, like this:

    protected $proxies = [
        '192.168.1.1',
        '192.168.1.2',
    ];

Maybe some logic/formatting is needed to achieve that. (tbr by @alexjustesen)

References:

@alexdelprete
Copy link
Contributor Author

alexdelprete commented Jan 20, 2023

@alexjustesen this line should be modified to be configured through an env variable (TRUSTED_PROXIES) that defaults to '*' if not configured.

I tried to use env() but there was an error so I forced it to '*'. You surely know how to do it, I don't. :)

protected $proxies = '*';

@alexjustesen alexjustesen merged commit 2c23a45 into alexjustesen:main Jan 28, 2023
@alpe12
Copy link

alpe12 commented May 11, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants