Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(cfg Config) fasthttp.RequestHandler
Handler creates a fasthttp.RequestHandler that proxies to the FastCGI upstream.
Types ¶
type Config ¶
type Config struct {
// Network is the FastCGI upstream network type ("tcp" or "unix").
Network string
// Address is the FastCGI upstream address (e.g., "127.0.0.1:9000" or "/run/php/php-fpm.sock").
Address string
// DocumentRoot is the root directory for PHP scripts on the upstream server.
DocumentRoot string
// Index is the default index file (default: "index.php").
Index string
// ListenPort is the port the proxy listens on (for SERVER_PORT).
ListenPort string
// DialTimeout for upstream connections.
DialTimeout time.Duration
// ReadTimeout for upstream reads.
ReadTimeout time.Duration
// WriteTimeout for upstream writes.
WriteTimeout time.Duration
// ResponseHeaders are additional headers added to every response.
ResponseHeaders map[string]string
// Locations defines external proxy locations with caching.
Locations []locationcache.Location
// LocationCache is an optional pre-built cache (for testing). If set, Locations is ignored.
LocationCache *locationcache.Cache
// StaticLocations defines paths that serve a pre-built inline response
// without any upstream call. Matched by exact path before the cache.
StaticLocations map[string]StaticResponse
// Pool configures the FastCGI connection pool.
Pool fcgi.PoolConfig
// CORS configures Cross-Origin Resource Sharing. When Enabled is false,
// CORS handling is a no-op.
CORS config.ParsedCORS
// Auth configures HTTP authentication applied before the FCGI dispatch.
// Bypasses /healthz, /readyz, static locations, and cached upstream
// locations (they serve before the auth check runs).
Auth config.ParsedAuth
// Readiness configures the /readyz endpoint that probes PHP-FPM's
// status page. When Enabled is false, /readyz behaves like /healthz.
Readiness config.ParsedReadiness
}
Config holds proxy configuration.
type StaticResponse ¶ added in v1.1.0
StaticResponse is a materialized inline response served for a configured location path. Fields correspond to config.ParsedReturn.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.