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.23k stars 638 forks source link

tileserver-gl with https protocol #1013

Open akram-mhss opened 1 year ago

akram-mhss commented 1 year ago

I've successfully set up Tileserver-GL on my Windows system, and it's working perfectly. However, the generated links are using the HTTP protocol, like this:

http://localhost:8080/styles/basic-preview/#14.61/33.57915/-7.60925

My requirement is to change the protocol from HTTP to HTTPS, like so:

https://localhost:8080/styles/basic-preview/#14.61/33.57915/-7.60925

The reason for this change is that when I replace "localhost" with my IP address and use it in my ASP.NET project, I encounter certain issues.

Here's a snippet of my code: L.tileLayer('http://192.168.*.***:8080/styles/basic-preview/{z}/{x}/{y}.png', { maxZoom: 19, }).addTo(map);

The error I'm encountering is as follows: "Mixed Content: The page at 'https://localhost:7077/Maps/Leaflet' was loaded over HTTPS, but requested an insecure image 'http://192.168.*.***:8080/styles/basic-preview/6/31/30.png'. This request has been blocked; the content must be served over HTTPS."

Furthermore, I've encountered another issue where, when I access the following link from my server (RDP), http://localhost:8080/, the Tileserver stops unexpectedly. However, when I attempt the same action from a machine (not a server), it functions properly. I'm in need of guidance on how to make the necessary adjustments to resolve these issues.

acalcutt commented 1 year ago

Typically I have tileserver-gl behind a real https server, like HAProxy, Nginx, or Apache

For the rdp thing I am not really sure. we would probably want to find a way to run tileserver as a service, so it doesn't really on the logged in session. I'm not 100% sure how you do that with node, but i will look.

btw, one of our members has a cool .Net port of tileserver-gl, which works in IIS https://github.com/tdcosta100/TileServerGL.NET

skompc commented 9 months ago

I second this. @acalcutt mind sharing your nginx config?