Apache 2.4: mod_proxy_fcgi
For Apache 2.4 you configure fastCGI with the mod_proxy_fcgi module. If authorization is used, configure a rewrite rule.
In this task you configure your Apache configuration file for mod_proxy_fcgi
to
connect to a GAS server. The GAS may be on a local or a remote machine.
If you are using authorization headers, see the configuration example in the section Rewrite-rule for authorization headers.
Apache 2.4 does not officially support mod_fastcgi
, use
mod_proxy_fcgi
instead. This module requires Genero Application Server 2.50 (or
later). For more information on Apache modules, refer to the Apache documentation.
Rewrite-rule for authorization headers
If you are using authorization headers, the module mod_rewrite
must be enabled
in your Apache configuration file. For example, the load module directive for this module must
appear without the hash (#) at the start of the line:
LoadModule rewrite_module modules/mod_rewrite.so
- Authorization headers need to be base64 encoded. Apache discards the Authorization header if it is not a base64-encoded user/password combination. A rewrite rule (see Apache 2.4 documentation) can be used to rewrite it from the server variable.
- A
ProxyPassReverse
directive can be set to adjust or rewrite URLs in response headers before forwarding them on to the client. For example, if an authorization request causes a redirect to an authentication server, Apache adjusts this URL to the local URL before forwarding the HTTP redirect response to the client.For more details on Apache, see Apache 2.4 documentation.
An example configuration is shown:
...
<VirtualHost _default_>
<IfModule proxy_fcgi_module>
...
# Unescapes the path component of the request URL
SetEnvIf Request_URI . proxy-fcgi-pathinfo=unescape
# Recreates the authorization header from the %{HTTP:Authorization} variable
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Maps the fastcgi server to the GAS URL space
ProxyPass /gas/ fcgi://gas-server-ip:gas-server-port/gas/ enablereuse=on timeout=100
# Rewrites URL in response headers
ProxyPassReverse /gas/ http://gas-server-ip:gas-server-port/gas/
# No alias
</IfModule>
</VirtualHost>
...