# These modules must be enabled : rewrite, fcgid
# (mod_fastcgi is much harder to configure)
# Configuration for http://localhost/puppet-dashboard
<VirtualHost localhost>
	# DefaultInitEnv for module mod_fcgid
	DefaultInitEnv RAILS_RELATIVE_URL_ROOT "/puppet-dashboard"
	DefaultInitEnv X_DEBIAN_SITEID "default"

	# the mod_fcgid socket path
	SocketPath "/var/run/puppet-dashboard/sockets/default"

	Alias "/puppet-dashboard/plugin_assets/" /var/cache/puppet-dashboard/default/plugin_assets/
	Alias "/puppet-dashboard" /usr/share/puppet-dashboard/public
	<Directory "/usr/share/puppet-dashboard/public">
		Options +FollowSymLinks +ExecCGI
		Order allow,deny
		Allow from all
		RewriteEngine On
		RewriteBase "/puppet-dashboard"
		RewriteRule ^$ index.html [QSA]
		RewriteRule ^([^.]+)$ $1.html [QSA]
		RewriteCond %{REQUEST_FILENAME} !-f [OR]
		RewriteCond %{REQUEST_FILENAME} dispatch.fcgi$
		RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
	</Directory>
</VirtualHost>
