Description: | SCGI gateway module formod_proxy |
---|---|
Status: | Extension |
Module Identifier: | proxy_scgi_module |
Source File: | mod_proxy_scgi.c |
Compatibility: | Available in version 2.2.14 and later |
This modulerequires the service ofmod_proxy
. It provides support for theSCGI protocol, version 1.
Thus, in order to get the ability of handling the SCGI protocol,mod_proxy
andmod_proxy_scgi
have to be present in the server.
Do not enable proxying until you havesecured your server. Open proxy servers are dangerous both to your network and to the Internet at large.
Remember, in order to make the following examples work, you have to enablemod_proxy
andmod_proxy_scgi
.
ProxyPass "/scgi-bin/" "scgi://localhost:4000/"
The balanced gateway needsmod_proxy_balancer
and at least one load balancer algorithm module, such asmod_lbmethod_byrequests
, in addition to the proxy modules listed above.mod_lbmethod_byrequests
is the default, and will be used for this example configuration.
ProxyPass "/scgi-bin/" "balancer://somecluster/"<Proxy "balancer://somecluster"> BalancerMember "scgi://localhost:4000" BalancerMember "scgi://localhost:4001"</Proxy>
In addition to the configuration directives that control the behaviour ofmod_proxy
, anenvironment variable may also control the SCGI protocol provider:
mod_proxy_scgi
will neither create nor export thePATH_INFO environment variable. This allows the backend SCGI server to correctly determineSCRIPT_NAME andScript-URI and be compliant with RFC 3875 section 3.3. If instead you needmod_proxy_scgi
to generate a "best guess" forPATH_INFO, set this env-var. The variable must be set beforeSetEnv
is effective.SetEnvIf
can be used instead:SetEnvIf Request_URI . proxy-scgi-pathinfo
Description: | Enable or disable internal redirect responses from thebackend |
---|---|
Syntax: | ProxySCGIInternalRedirect On|Off|Headername |
Default: | ProxySCGIInternalRedirect On |
Context: | server config, virtual host, directory |
Status: | Extension |
Module: | mod_proxy_scgi |
Compatibility: | TheHeadername feature is available in version2.4.13 and later |
TheProxySCGIInternalRedirect
enables the backend to internally redirect the gateway to a different URL. This feature originates inmod_cgi
, which internally redirects the response if the response status isOK
(200
) and the response contains aLocation
(or configured alternate header) and its value starts with a slash (/
). This value is interpreted as a new local URL that Apache httpd internally redirects to.
mod_proxy_scgi
does the same asmod_cgi
in this regard, except that you can turn off the feature or specify the use of a header other thanLocation
.
ProxySCGIInternalRedirect Off# Django and some other frameworks will fully qualify "local URLs"# set by the application, so an alternate header must be used.<Location /django-app/> ProxySCGIInternalRedirect X-Location</Location>
Description: | Enable evaluation ofX-Sendfile pseudo responseheader |
---|---|
Syntax: | ProxySCGISendfile On|Off|Headername |
Default: | ProxySCGISendfile Off |
Context: | server config, virtual host, directory |
Status: | Extension |
Module: | mod_proxy_scgi |
TheProxySCGISendfile
directive enables the SCGI backend to let files be served directly by the gateway. This is useful for performance purposes — httpd can usesendfile
or other optimizations, which are not possible if the file comes over the backend socket. Additionally, the file contents are not transmitted twice.
TheProxySCGISendfile
argument determines the gateway behaviour:
Off
On
X-Sendfile
and interprets the value as the filename to serve. The header is removed from the final response headers. This is equivalent toProxySCGISendfile X-Sendfile
.On
, but instead of the hardcoded header nameX-Sendfile
, the argument is used as the header name.# Use the default header (X-Sendfile)ProxySCGISendfile On# Use a different headerProxySCGISendfile X-Send-Static
Copyright 2025 The Apache Software Foundation.
Licensed under theApache License, Version 2.0.