maptiler / tileserver-gl

Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
https://tileserver.readthedocs.io/en/latest/
Other
2.24k stars 639 forks source link

nginx proxy stuck on loading... page #569

Open michal-sedek-ihub opened 2 years ago

michal-sedek-ihub commented 2 years ago

Hello, I 'm trying to install maptiler behind the nginx proxy, and I'm stuck. In nginx conf i have: ` location /maptiler { client_max_body_size 10M;

     proxy_headers_hash_max_size 512;
     proxy_headers_hash_bucket_size 128;

    include /etc/nginx/conf.d/x-forwarded-for.local.conf;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_pass http://maptiler-local:3650/;
}`

in maptiler dockerfile config just: FROM maptiler/server

and in docker-compose.yml:

`maptiler: image: ${IMAGE_PATH}maptiler:${TAG} container_name: maptiler-${TAG} ports:

And in nginx logs when I try to go to http://localhost:7070/maptiler i'm getting only: 192.168.0.1 - - [18/Feb/2022:11:34:33 +0000] "GET /maptiler HTTP/1.1" 200 1255 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36"

But on screen i get "Loading..." and nothing more :/ and when i try to go to localhost:7070/maptiler/admin i get 404 error

Can you please tell me what i'm doing wrong? :) Or what should i do different to get the server working?

scara commented 2 years ago

Hi @michal-sedek-ihub; never tried using nginx but my two cents:

  1. align the trailing slash among location and proxy_pass
  2. tileserver-gl is not so much rev proxy friendly so you need to help it by passing an argument to tell that it is running under a rev proxy: --public_url http://localhost:7070/maptiler

HTH, Matteo

michal-sedek-ihub commented 2 years ago

Hi Matteo, Thanks for answering, I added --proxy_url but the docker image says, that it doesn't know what that means, so i changed it to -u, and ... still nothing :)

Now I have in docker-compose.yml sth like that:

  maptiler:
    image: ${IMAGE_PATH}maptiler:local
    container_name: maptiler-local
    command:
      - "-p 8080"
      - "-c /data/config.json"
      - "-V"
      - "- http://localhost:7070/maptiler"
    expose:
      - "${MAPTILER_EXPOSED_PORT}"
    ports:
      - "${MAPTILER_EXPOSED_PORT}:${MAPTILER_INTERNAL_PORT}"

And the page is loading, but all links direct to http://localhost:7070/... and not to http://localhost:7070/maptiler/... (ex. styles should be at http://localhost:7070/maptiler/styles/ but all links direct to http://localhost:7070/styles, and even if I go directly to http://localhost:7070/maptiler/styles/ I get Cannot get //styles/ error). It is like -u doesn't propagate through the frontend links :)

If i remove the -u and go to the http://localhost:8080 (8080 is the MAPTILER_EXPOSED/INTERNAL_PORT) everything is working fine, but it isn't going through proxy (and i need it behind proxy :) )

Thanks, Michal

acalcutt commented 1 year ago

I know this is old, but does the new information at https://maptiler-tileserver.readthedocs.io/en/latest/deployment.html#nginx-reverse-proxy help with these questions?