allow from all
Options FollowSymLinks
Require all granted
SetEnv no-gzip

RewriteEngine on

# Make sure the browser supports gzip encoding before we send it
# without it, Content-Type will be "application/x-gzip"
RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b
RewriteCond %{REQUEST_FILENAME}.gz -s
RewriteRule ^(.+) $1.gz

# Check if file doesn't exists and is a map file
RewriteCond %{REQUEST_URI} "^/maps"
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite request to emptyTile
RewriteRule ^.*$ /assets/emptyTile.json [L]

# Also add a content-encoding header to tell the browser to decompress
<FilesMatch .json.gz$>
	ForceType application/json
	Header set Content-Encoding gzip
</FilesMatch>

# Also add a content-encoding header to tell the browser to decompress
<FilesMatch .prbm.gz$>
	ForceType application/octet-stream
	Header set Content-Encoding gzip
</FilesMatch>


# OPTIONAL:
# Proxy requests to the live data interface to bluemaps integrated webserver  
#ProxyPreserveHost On
#ProxyPassMatch ^/(maps/[^/]*/live/.*) http://127.0.0.1:8100/$1