ITS wiki

The Incompatible Timesharing System

User Tools

Site Tools


revproxy

This is an old revision of the document!


Setting up a reverse proxy for the httpd web server

Not as easy as it may seem. This page describes things to do in your Linux host.

Install apache2 with mod_proxy, mod_proxy_html and mod_proxy_http

Enable mod_rewrite, mod_cache, mod_proxy, mod_proxy_http, mod_proxy_html

Configuration:

Throttle the Apache server to match to ITS server: # ITS can really only handle one connection at a time! MaxRequestsPerChild 1 ThreadsPerChild 1 MaxClients 1

Basic VirtualHost stuff:

<VirtualHost *:80>

ServerAdmin victor@up.update.uu.se
ServerSignature off
ProxyRequests off
ServerName up.update.uu.se
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/up-error.log
CustomLog ${APACHE_LOG_DIR}/up-access.log combined

# ProxyHTMLLogVerbose on

LogLevel error

Optional: error documents for when the ITS server fails/crashes:

Alias /its-error/ "/home/klh10/its/apache-errors/"
ProxyPass /its-error/ !
ProxyErrorOverride on
ErrorDocument 503 /its-error/503.html
ErrorDocument 404 /its-error/404.html

Optional(?): caching

CacheEnable disk /

Optional: avoid robots which don't seem to respect robots.txt

# Forbid the darn Baidu robot which doesn't respect robots.txt! And the Page2RSS thing which also doesn't, and connects every 2 minutes
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.*Baiduspider [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Page2RSS [NC]
RewriteRule .* - [L,F]

The real stuff: the proxy

<Location />
  ProxyPass http://its-up.update.uu.se/ nocanon max=1 disablereuse=on retry=0 timeout=10 connectiontimeout=5
  ProxyPassReverse http://its-up.update.uu.se/
  # ITS only handles HTTP 1.0 and no keepalive
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1
  Order allow,deny
  Allow from all
</Location>
revproxy.1453898230.txt.gz · Last modified: (external edit)