I am following the tutorial production-postgis-vector-tiles-caching. However when I try to setup pg_tileserve to serve tiles under reverse proxy and varnish also under reverse proxy, I always get an error Error 503 Backend fetch failed. My docker-compose looks like
tiles:
image: pramsey/pg_tileserv
volumes:
- ./config/pg_tileserv.toml:/etc/pg_tileserv.toml
environment:
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASS}@${POSTGRES_HOST}/${POSTGRES_DB}
- TS_URLBASE=${VECTOR_TILES_URL}
- TS_BASEPATH=/tiles
depends_on:
db:
condition: service_healthy
restart: always
cache:
image: eeacms/varnish
environment:
BACKENDS: 'tiles:7800'
DNS_ENABLED: 'false'
COOKIES: 'true'
PARAM_VALUE: '-p default_ttl=600'
VARNISH_BACKEND_PATH: '/'
depends_on:
tiles:
condition: service_started
restart: always
nginx:
image: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
depends_on:
- tiles
- cache
ports:
- "80:80"
And my nginx config looks like this:
location /tiles {
proxy_pass http://tiles;
}
location /cache {
proxy_pass http://cache;
}
How can I modify my varnish config, considering my tiles are available on http://localhost/tiles and varnish should be available from http://localhost/cache