Setting up Apache HTTPD as a proxy server

Requirements:

  • Apache HTTPD 2.2.25 or greater with OpenSSL
  • Running Grid accessible from the Apache server
  1. Create a httpd-gridproxy.conf file in the %apache_home%\conf\extra\ folder with the following configuration lines, configuring the URL and respective endpoint, examples are given for HTTP and HTTPS proxying of the grid WebUI URL.
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule ssl_module modules/mod_ssl.so
    
    # Disable forward proxy
    ProxyRequests Off
    
    #Configure access control
    Order deny,allow
    Allow from all
    	
    # Pass /gridhttp URL to http port of Grid router
    ProxyPass /gridhttp http://server:port/grid/ui
    ProxyPassReverse /gridhttp http://server:port/grid/ui
    
    # Pass /gridhttps URL to https port of Grid router
    ProxyPass /gridhttps https://server:port/grid/ui
    ProxyPassReverse /gridhttps https://server:port/grid/ui
  2. Add the following lines to the bottom of the %apache_home%\conf\httpd.conf file:
    # Grid Proxy Configuration
    Include conf/extra/httpd-gridproxy.conf
    
  3. Add the following line to the %apache_home%\conf\extra\httpd-ssl.conf file immediately after the SSLEngine on line:
  4. Install an SSL certificate and keyfile in the %apache_home%\conf\ folder, by default these should be named server.crt and server.key. A self-signed server certificate can be generated using OpenSSL:
    set OPENSSL_CONF=%apache_home%\conf\openssl.cnf
    %apache_home%\bin>openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout %apache_home%\conf\server.key -out %apache_home%\conf\server.crt
    Note: It is strongly recommended that a CA signed certificate is used.
  5. Restart Apache.