Proxying through Apache
A Pootle Web-translation server is made up of static and dynamic content. By default Pootle serves all content, for low-latency purposes it is better to get Apache to serve the content that does not change, the static content. It is just the issue of low latency and making the translation experience more interactive that calls you to proxy through Apache. The following steps show you how to setup Pootle to proxy through Apache.
Most of the documentation below assumes that you are using Apache 2 and that your configuration is stored in /etc/apache2 with the configuration as is common in Debian based systems. Furthermore it assumes that the Pootle server is running on the same host as Apache and is listening on port 8080. On other systems, the configuration might be in /etc/httpd/ with module configuration in /etc/httpd/modules.d/ or similar.
To begin with, you might need to enable mod_proxy on Apache. First ensure that mod_proxy is available by checking for the file /etc/apache2/mods-available/proxy.conf. To ensure that all the modules are enabled, make sure that the necessary proxy modules are linked from /etc/apache2/mods-enabled/. You will probably need the following modules:
- proxy.conf
- proxy.load
- proxy_http.load
Now authorise proxy requests in proxy.conf otherwise you could end up with an unreachable web site and messages such as client denied by server configuration: proxy:http://localhost:8080/ in your log files:
<Proxy localhost:8080> Order Allow,Deny Allow from localhost </Proxy>
Here is an example httpd.conf to create a virtual host for Pootle and also proxy through from Apache to the Pootle port. This might be suitable for putting in /etc/apache2/sites-available/, /etc/httpd/conf/vhosts.d/ or similar.
<VirtualHost *:*>
ServerName pootle.locamotion.org
ServerAlias pootle.sjsoft.com
ServerAlias www.wordforge.org
ServerAlias wordforge.org
ProxyPass /images !
ProxyPass /js !
ProxyPass /pootle.css !
ProxyPass /favicon.ico !
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
<Directory proxy:http://localhost:8080/*>
Order deny,allow
Allow from all
</Directory>
ErrorLog logs/pootle-error_log
CustomLog logs/pootle-access_log common
# Fallback for static html content
DocumentRoot "/usr/lib/python2.4/site-packages/Pootle/html/"
<Directory "/usr/lib/python2.4/site-packages/Pootle/html/">
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
With Apache 1.3, the ProxyPass directive does not support !. You must replace these ! by a url (e.g. Proxypass /images http://localhost/pootle/images).