[MapProxy] WMTS Caching with Redis: Configuration Review Request

Louis Pauchet louis.pauchet at outlook.com
Wed Nov 5 04:27:32 PST 2025


Dear MapProxy Community,

I’m working on a project that uses MapProxy with Mapnik to render custom map layers, which are updated daily based on environmental conditions. My goal is to use WMTS with a Redis cache to handle traffic spikes efficiently, while ensuring tiles expire within 10 minutes to minimize inconsistencies after updates.

However, my current configuration seems to cache tiles in the local directory instead of Redis, so layer updates are not reflected until the cache is manually cleared. Since I plan to run multiple MapProxy instances behind a Kubernetes reverse proxy, I’d like to avoid manual cleanup tasks.

I suspect I may have misunderstood the Redis integration. Could someone review my configuration below and confirm if it’s set up correctly to use Redis as the primary cache? Here’s my current configuration:

services:
  demo:
  wmts:
  wms:
    srs: ["EPSG:3857"]
    image_formats: ["image/png", "image/jpeg"]
    on_source_errors: notify


layers:
  - name: met_icechart
    title: Latest Ice Chart
    sources: [icechart_cache]
    wmts_rest_legendurl: "{base_url}/metadata/{layer_name}/legend.html"
    wmts_kvp_legendurl: "{base_url}/metadata/{layer_name}/legend.html"


caches:
  icechart_cache:
    grids: [webmercator]
    sources: [icechart]
    type: redis
    default_ttl: 600


sources:
  icechart:
    type: mapnik
    mapfile: /mapproxy/data/latest_seaice/latest.xml
    layers: latest_ice_chart
    transparent: true
    multithreaded: true

grids:
    webmercator:
        base: GLOBAL_WEBMERCATOR

globals:
  cache:
    redis:
      host: $MAPPROXY_REDIS_HOST
      port: $MAPPROXY_REDIS_PORT
      username: $MAPPROXY_REDIS_USERNAME
      password: $MAPPROXY_REDIS_PASSWORD


Any examples of working configurations or suggestions for troubleshooting would be greatly appreciated! The environments variables for Redis are update in my container during the startup process. My test environment have the following docker compose :

services:

# Redis service for caching in MapProxy
  redis:
    image: redis:7.4-alpine
    restart: always
    # ports:
      # - "6379:6379"
    command: redis-server --save 20 1 --loglevel verbose --requirepass iamgreatpassword
    networks:
      - swi_network
    extra_hosts:
      - "host.docker.internal:host-gateway"

# MapProxy service serving the WMTS service
  mapproxy-server:
    image: swi-mapproxy:latest
    # ports:
    #   - "8080:8080"
    volumes:
      - ./data/mapproxy/data/:/mapproxy/data
      - ./data/mapproxy/metadata/:/mapproxy/metadata
      - ./data/mapproxy/cache/:/mapproxy/config/cache_data
    environment:
     - MAPPROXY_REDIS_HOST=redis
     - MAPPROXY_REDIS_PORT=6379
     - MAPPROXY_REDIS_USERNAME=default
     - MAPPROXY_REDIS_PASSWORD=iamgreatpassword
    depends_on:
      - redis
    networks:
      - swi_network
    extra_hosts:
      - "host.docker.internal:host-gateway"

networks:
  swi_network:
    driver: bridge

Thank you in advance for your help.

Best regards,

Louis Pauchet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapproxy/attachments/20251105/437b8b76/attachment-0001.htm>


More information about the MapProxy mailing list