go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.28k stars 194 forks source link

uri_prefix option not working behind reverse proxy #724

Closed CptSchnitz closed 3 years ago

CptSchnitz commented 3 years ago

I am running tegola in kubernetes behind a ingress with a subpath. I am able to access tegola just fine, but the urls in the capabilities dont include the subpath. I have set the option to change the prefix in the config and it doesn't work. I have tried it both with forward slash "/mvt" and without "mvt".

config:

[webserver]
port = ":${TILER_SERVER_PORT}"
uri_prefix = "/mvt"

# Tegola offers three tile caching strategies: "file", "redis", and "s3"
[cache]
type = "${TILER_CACHE_TYPE}"
basepath ="${TILER_CACHE_BASEPATH}"
max_zoom = "${TILER_CACHE_MAX_ZOOM}"

bucket = "${TILER_CACHE_BUCKET}"
region = "${TILER_CACHE_REGION}"
aws_access_key_id = "${TILER_CACHE_AWS_ACCESS_KEY_ID}"
aws_secret_access_key = "${TILER_CACHE_AWS_SECRET_ACCESS_KEY}"

capabilities (http://192.168.49.2/mvt/capabilities)

[
  {
    "name": "osm",
    "attribution": "OpenStreetMap",
    "bounds": [-180, -85.0511, 180, 85.0511],
    "center": [-74.275329586789, -12.153492567373, 8],
    "tiles": ["http://192.168.49.2/maps/osm/{z}/{x}/{y}.pbf"],
    "capabilities": "http://192.168.49.2/capabilities/osm.json",
    "layers": [
      {
        "name": "populated_places",
        "tiles": [
          "http://192.168.49.2/maps/osm/populated_places/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 0,
        "maxzoom": 20
      },
      {
        "name": "country_lines",
        "tiles": ["http://192.168.49.2/maps/osm/country_lines/{z}/{x}/{y}.pbf"],
        "minzoom": 0,
        "maxzoom": 10
      },
      {
        "name": "country_lines_disputed",
        "tiles": [
          "http://192.168.49.2/maps/osm/country_lines_disputed/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 3,
        "maxzoom": 10
      },
      {
        "name": "country_label_points",
        "tiles": [
          "http://192.168.49.2/maps/osm/country_label_points/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 3,
        "maxzoom": 20
      },
      {
        "name": "country_polygons",
        "tiles": [
          "http://192.168.49.2/maps/osm/country_polygons/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 0,
        "maxzoom": 10
      },
      {
        "name": "state_lines",
        "tiles": ["http://192.168.49.2/maps/osm/state_lines/{z}/{x}/{y}.pbf"],
        "minzoom": 0,
        "maxzoom": 10
      },
      {
        "name": "land",
        "tiles": ["http://192.168.49.2/maps/osm/land/{z}/{x}/{y}.pbf"],
        "minzoom": 0,
        "maxzoom": 20
      },
      {
        "name": "admin_lines",
        "tiles": ["http://192.168.49.2/maps/osm/admin_lines/{z}/{x}/{y}.pbf"],
        "minzoom": 8,
        "maxzoom": 20
      },
      {
        "name": "state_label_points",
        "tiles": [
          "http://192.168.49.2/maps/osm/state_label_points/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 3,
        "maxzoom": 20
      },
      {
        "name": "landuse_areas",
        "tiles": ["http://192.168.49.2/maps/osm/landuse_areas/{z}/{x}/{y}.pbf"],
        "minzoom": 3,
        "maxzoom": 20
      },
      {
        "name": "water_areas",
        "tiles": ["http://192.168.49.2/maps/osm/water_areas/{z}/{x}/{y}.pbf"],
        "minzoom": 3,
        "maxzoom": 20
      },
      {
        "name": "water_lines",
        "tiles": ["http://192.168.49.2/maps/osm/water_lines/{z}/{x}/{y}.pbf"],
        "minzoom": 8,
        "maxzoom": 20
      },
      {
        "name": "transport_lines",
        "tiles": [
          "http://192.168.49.2/maps/osm/transport_lines/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 3,
        "maxzoom": 20
      },
      {
        "name": "transport_areas",
        "tiles": [
          "http://192.168.49.2/maps/osm/transport_areas/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 12,
        "maxzoom": 20
      },
      {
        "name": "transport_points",
        "tiles": [
          "http://192.168.49.2/maps/osm/transport_points/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 14,
        "maxzoom": 20
      },
      {
        "name": "amenity_areas",
        "tiles": ["http://192.168.49.2/maps/osm/amenity_areas/{z}/{x}/{y}.pbf"],
        "minzoom": 14,
        "maxzoom": 20
      },
      {
        "name": "amenity_points",
        "tiles": [
          "http://192.168.49.2/maps/osm/amenity_points/{z}/{x}/{y}.pbf"
        ],
        "minzoom": 14,
        "maxzoom": 20
      },
      {
        "name": "other_points",
        "tiles": ["http://192.168.49.2/maps/osm/other_points/{z}/{x}/{y}.pbf"],
        "minzoom": 14,
        "maxzoom": 20
      },
      {
        "name": "other_lines",
        "tiles": ["http://192.168.49.2/maps/osm/other_lines/{z}/{x}/{y}.pbf"],
        "minzoom": 14,
        "maxzoom": 20
      },
      {
        "name": "other_areas",
        "tiles": ["http://192.168.49.2/maps/osm/other_areas/{z}/{x}/{y}.pbf"],
        "minzoom": 6,
        "maxzoom": 20
      },
      {
        "name": "buildings",
        "tiles": ["http://192.168.49.2/maps/osm/buildings/{z}/{x}/{y}.pbf"],
        "minzoom": 14,
        "maxzoom": 20
      }
    ]
  }
]
ARolek commented 3 years ago

@CptSchnitz your config looks good. Which version of tegola are you running?

CptSchnitz commented 3 years ago

0.8.1, didn't notice it was that old. will it work in a newer version?

ARolek commented 3 years ago

@CptSchnitz it should! I'm using it on v0.12.1 with no problems.

CptSchnitz commented 3 years ago

thanks! it fixed it.

ARolek commented 3 years ago

Nice! I like the easy ones ;-)