# requires apache2 ≥ 2.4.13 for ap_expr evaluation in ErrorDocument
# required apache2 modules: proxy_http, deflate, expires, headers
<VirtualHost *:3080>
	ServerName man.localhost

	ServerAdmin webmaster@localhost
	DocumentRoot /srv/man

	LogLevel alert

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# Add gzip to the Accept-Encoding to prevent apache from serving an
	# HTTP 406 Not Acceptable response. We keep the original
	# Accept-Encoding value and later on use mod_deflate to uncompress if
	# necessary.
	RequestHeader set Accept-Encoding "expr=gzip,%{req:Accept-Encoding}" early

	ExpiresActive On
	ExpiresDefault "access plus 1 hours"

	<Files ~ "^rwmap">
		Order allow,deny
		Deny from all
	</Files>

	<Location /auxserver/>
		ProxyPass "http://localhost:2431/"
		ProxyPassReverse "http://localhost:2431/"
	</Location>

	ErrorDocument 404 /auxserver/%{REQUEST_URI}?%{QUERY_STRING}

	<Directory /srv/man>
		Require all granted

		# To set the correct Content-Type (e.g. text/html).
		RemoveType .gz
		AddEncoding gzip gz
		FilterDeclare gzip CONTENT_SET
		FilterProvider gzip inflate "%{req:Accept-Encoding} !~ /gzip,.*gzip/"
		FilterChain gzip
		Options +Multiviews
	</Directory>

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
