Skip to content
Snippets Groups Projects

Tiles Proxy

TilesProxy: a cache proxy for tiles.

The aim of this little server is to act as a proxy for geographic tiles servers in order to limit calls to their services from our web applications.

Supported standards for tiles:

Configuration of origin tiles servers is done in a TOML file. See tiles-proxy.toml for example.

To enable browser caching, HTTP headers are added: ETag and Cache-Control. CORS headers are also added to enable canvas export (eg.: in OpenLayers) from browser.

Getting started

Install Rust

Tiles Proxy uses the web framework for Rust: Rocket. Because of this, we'll need a recent release of Rust to run Rocket applications. If you already have a working installation of the latest Rust compiler, feel free to skip to the next section.

First, install rustup.

# install rustup, Proceed with standard installation
curl https://sh.rustup.rs -sSf | sh
# read the output to configure your shell

Once rustup is installed, ensure the latest toolchain is installed by running the command:

rustup default stable

Add pkg-config to compile openssl-sys

sudo apt install pkg-config

Development

Format code with

cargo fmt --

Test with

cargo test

Use a linter with

cargo clippy

Commits

Commit messages must follow the Conventional Commits specification, a lightweight convention to write the commit message text.

Configure VSCodium / VS Code

Recommended extensions:

Build

cargo build --release

Binary is at target/release/tiles-proxy.

Run

cargo run tiles-proxy.toml

or

tiles-proxy tiles-proxy.toml