Class FastCGIProxyServlet

  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class FastCGIProxyServlet
    extends AsyncProxyServlet.Transparent
    Specific implementation of AsyncProxyServlet.Transparent for FastCGI.

    This servlet accepts an HTTP request and transforms it into a FastCGI request that is sent to the FastCGI server specified in the proxyTo init-param.

    This servlet accepts these additional init-params:

    • scriptRoot, mandatory, that must be set to the directory where the application that must be served via FastCGI is installed and corresponds to the FastCGI DOCUMENT_ROOT parameter
    • scriptPattern, optional, defaults to (.+?\.php), that specifies a regular expression with at least 1 and at most 2 groups that specify respectively:
      • the FastCGI SCRIPT_NAME parameter
      • the FastCGI PATH_INFO parameter
    • fastCGI.HTTPS, optional, defaults to false, that specifies whether to force the FastCGI HTTPS parameter to the value on
    • fastCGI.envNames, optional, a comma separated list of environment variable names read via System.getenv(String) that are forwarded as FastCGI parameters.
    See Also:
    TryFilesFilter, Serialized Form
    • Field Detail

      • SCRIPT_ROOT_INIT_PARAM

        public static final java.lang.String SCRIPT_ROOT_INIT_PARAM
        See Also:
        Constant Field Values
      • SCRIPT_PATTERN_INIT_PARAM

        public static final java.lang.String SCRIPT_PATTERN_INIT_PARAM
        See Also:
        Constant Field Values
      • ORIGINAL_URI_ATTRIBUTE_INIT_PARAM

        public static final java.lang.String ORIGINAL_URI_ATTRIBUTE_INIT_PARAM
        See Also:
        Constant Field Values
      • ORIGINAL_QUERY_ATTRIBUTE_INIT_PARAM

        public static final java.lang.String ORIGINAL_QUERY_ATTRIBUTE_INIT_PARAM
        See Also:
        Constant Field Values
      • FASTCGI_HTTPS_INIT_PARAM

        public static final java.lang.String FASTCGI_HTTPS_INIT_PARAM
        See Also:
        Constant Field Values
      • FASTCGI_ENV_NAMES_INIT_PARAM

        public static final java.lang.String FASTCGI_ENV_NAMES_INIT_PARAM
        See Also:
        Constant Field Values
      • REMOTE_ADDR_ATTRIBUTE

        private static final java.lang.String REMOTE_ADDR_ATTRIBUTE
      • REMOTE_PORT_ATTRIBUTE

        private static final java.lang.String REMOTE_PORT_ATTRIBUTE
      • SERVER_NAME_ATTRIBUTE

        private static final java.lang.String SERVER_NAME_ATTRIBUTE
      • SERVER_ADDR_ATTRIBUTE

        private static final java.lang.String SERVER_ADDR_ATTRIBUTE
      • SERVER_PORT_ATTRIBUTE

        private static final java.lang.String SERVER_PORT_ATTRIBUTE
      • SCHEME_ATTRIBUTE

        private static final java.lang.String SCHEME_ATTRIBUTE
      • REQUEST_URI_ATTRIBUTE

        private static final java.lang.String REQUEST_URI_ATTRIBUTE
      • REQUEST_QUERY_ATTRIBUTE

        private static final java.lang.String REQUEST_QUERY_ATTRIBUTE
      • scriptPattern

        private java.util.regex.Pattern scriptPattern
      • originalURIAttribute

        private java.lang.String originalURIAttribute
      • originalQueryAttribute

        private java.lang.String originalQueryAttribute
      • fcgiHTTPS

        private boolean fcgiHTTPS
      • fcgiEnvNames

        private java.util.Set<java.lang.String> fcgiEnvNames
    • Constructor Detail

      • FastCGIProxyServlet

        public FastCGIProxyServlet()
    • Method Detail

      • init

        public void init()
                  throws javax.servlet.ServletException
        Overrides:
        init in class AbstractProxyServlet
        Throws:
        javax.servlet.ServletException
      • sendProxyRequest

        protected void sendProxyRequest​(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse proxyResponse,
                                        Request proxyRequest)
        Overrides:
        sendProxyRequest in class AbstractProxyServlet
      • customizeFastCGIHeaders

        protected void customizeFastCGIHeaders​(Request proxyRequest,
                                               HttpFields fastCGIHeaders)