Apache: configure for reverse proxy
An Apache reverse proxy configuration allows you to get the URL used by the GAS when a reverse proxy server is used.
Configuration instructions provided in this page will probably work in the majority of situations, but sometimes they may require adaptation depending on the version of Apache you have. Therefore, we recommend that you refer to the Apache documentation (external link) if you need to know about specific configuration options. In production environments, the configuration of the Apache HTTP server should be carried out by a system administrator to avoid security issues.
Simplifying the configuration
In your network configuration for reverse proxy it is recommended to use the same URI (for
example, /gas
) for the reverse proxy as the backends where the GAS is running. This means that
you will not need to do any further configuration than what is outlined in the steps in this
task.
ProxyFCGISetEnvIf "true" SCRIPT_NAME "/main"
This directs the Apache web server to build URLs with the /main URI instead of the /backend URI.
When the GAS sits behind a proxy, the Apache reverse proxy
configuration ensures the GAS
URLs are reachable provided the following X-Forwarded
headers are available: X-Forwarded-Proto should contain HTTP or HTTPS, X-Forwarded-Host should contain
host:port, and X-Forwarded-Prefix should contain the PathBase
(/path/base) of the URI.
The GAS will automatically use these header values (if present) to build the URL used by the client.
In this task, you
configure Apache for the X-Forwarded
headers. For more information on forwarded
HTTP headers, see rfc7239.