Previous: Tile Server Configuration, Up: Tile Server Configuration [Contents][Index]
The OpenStreetMap tile server redirects HTTP requests to HTTPS but Trip Server does not support using HTTPS requests. Either Apache or Nginx can be configured to forward HTTP requests to an HTTPS tile server.
See also See Proxy Web Servers
Configure the tile server in trip-server.yaml to use
http://localhost:8088 with a path prefixed with
/tile-proxy, e.g.
        protocol: "http:"
        host: localhost
        port: "8088"
        path: /tile-proxy/osm/{z}/{x}/{y}.png
        method: GET
Then configure the Apache or Nginx web server to forward those requests to the HTTPS tile server.
Enable the proxy_http and rewrite Apache modules:
a2enable proxy_http a2enmod rewrite
Add a configuration element similar to the following example:
Listen 8088
<VirtualHost localhost:8088>
  LogLevel warn
  ErrorLog ${APACHE_LOG_DIR}/proxy-error.log
  CustomLog ${APACHE_LOG_DIR}/proxy-access.log combined
  <IfModule mod_rewrite.c>
    RewriteEngine On
    # Modify the target host to the tile server URL
    rewriteRule "^/tile-proxy/osm/(.*)$" "https://tile.openstreetmap.org/$1" [P]
  </IfModule>
</VirtualHost>
Add a configuration element similar to the following example:
server {
	listen 8088 default_server;
	listen [::]:8088 default_server;
	location /tile-proxy/osm/ {
		allow 127.0.0.1;
		deny all;
		rewrite ^/tile-proxy/osm/(.*) /$1 break;
		proxy_pass https://tile.openstreetmap.org;
	}
}