Download the PHP package componenta/http-trusted-proxy-middleware without Composer
On this page you can find all versions of the php package componenta/http-trusted-proxy-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download componenta/http-trusted-proxy-middleware
More information about componenta/http-trusted-proxy-middleware
Files in componenta/http-trusted-proxy-middleware
Package http-trusted-proxy-middleware
Short Description Trusted proxy PSR-15 middleware for Componenta
License MIT
Informations about the package http-trusted-proxy-middleware
Componenta HTTP Trusted Proxy Middleware
PSR-15 middleware for resolving client IP, scheme, host, and port from trusted proxy headers. It is useful when the application runs behind a reverse proxy or load balancer.
Installation
This package has no config provider. Create the configuration and middleware explicitly.
Quick Start
Runtime Behavior
When the remote address is trusted, the middleware reads forwarding headers, resolves the original client IP, and updates the request URI scheme, host, and port. It writes the resolved client IP to the client_ip request attribute.
When the remote address is not trusted, forwarding headers are ignored and stripped from the downstream request. Forwarding headers are also stripped after a trusted proxy request is resolved, so application code should read the modified URI and client_ip attribute instead of raw headers.
TrustedHeaders supports XForwarded, Forwarded, and All.
trustPrivateNetworks: true also trusts common private and loopback ranges. Leave it disabled unless the deployment topology makes those ranges trusted.
Related Packages
componenta/http-throttle-middleware uses client_ip when it is available.