Class FastCGIProxyServlet

All Implemented Interfaces:
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:
  • Field Details

    • SCRIPT_ROOT_INIT_PARAM

      public static final String SCRIPT_ROOT_INIT_PARAM
      See Also:
    • SCRIPT_PATTERN_INIT_PARAM

      public static final String SCRIPT_PATTERN_INIT_PARAM
      See Also:
    • ORIGINAL_URI_ATTRIBUTE_INIT_PARAM

      public static final String ORIGINAL_URI_ATTRIBUTE_INIT_PARAM
      See Also:
    • ORIGINAL_QUERY_ATTRIBUTE_INIT_PARAM

      public static final String ORIGINAL_QUERY_ATTRIBUTE_INIT_PARAM
      See Also:
    • FASTCGI_HTTPS_INIT_PARAM

      public static final String FASTCGI_HTTPS_INIT_PARAM
      See Also:
    • FASTCGI_ENV_NAMES_INIT_PARAM

      public static final String FASTCGI_ENV_NAMES_INIT_PARAM
      See Also:
    • REMOTE_ADDR_ATTRIBUTE

      private static final String REMOTE_ADDR_ATTRIBUTE
    • REMOTE_PORT_ATTRIBUTE

      private static final String REMOTE_PORT_ATTRIBUTE
    • SERVER_NAME_ATTRIBUTE

      private static final String SERVER_NAME_ATTRIBUTE
    • SERVER_ADDR_ATTRIBUTE

      private static final String SERVER_ADDR_ATTRIBUTE
    • SERVER_PORT_ATTRIBUTE

      private static final String SERVER_PORT_ATTRIBUTE
    • SCHEME_ATTRIBUTE

      private static final String SCHEME_ATTRIBUTE
    • REQUEST_URI_ATTRIBUTE

      private static final String REQUEST_URI_ATTRIBUTE
    • REQUEST_QUERY_ATTRIBUTE

      private static final String REQUEST_QUERY_ATTRIBUTE
    • scriptPattern

      private Pattern scriptPattern
    • originalURIAttribute

      private String originalURIAttribute
    • originalQueryAttribute

      private String originalQueryAttribute
    • fcgiHTTPS

      private boolean fcgiHTTPS
    • fcgiEnvNames

      private Set<String> fcgiEnvNames
  • Constructor Details

    • FastCGIProxyServlet

      public FastCGIProxyServlet()
  • Method Details

    • init

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

      protected HttpClient newHttpClient()
      Description copied from class: AbstractProxyServlet
      The servlet init parameter 'selectors' can be set for the number of selector threads to be used by the HttpClient.
      Overrides:
      newHttpClient in class AbstractProxyServlet
      Returns:
      a new HttpClient instance
    • 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)