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.19k stars 632 forks source link

SIGHUP doesn't update Last-Modified header #359

Open korywka opened 5 years ago

korywka commented 5 years ago

If you are using docker kill --signal=SIGHUP ${containerId}, it is better to remove this header by nginx: add_header Last-Modified "";. In spite of this header is weak for cache control (according to articles), I think it should be updated.

petrsloup commented 5 years ago

What type of requests do you have in mind?

The rasterized tiles and fonts have Last-Modified that should update in case of SIGHUP. The raw data (e.g. .pbf tiles from .mbtiles) have Last-Modified based on the last modification of the .mbtiles file, which I believe is a correct behavior.

korywka commented 5 years ago

*.mbtiles:

Request to docker container: 14:30:24 GMT

curl --head localhost:8080/data/buildings/14/9569/5517.pbf
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/x-protobuf
Content-Encoding: gzip
Last-Modified: Wed, 24 Apr 2019 14:30:24 GMT
Content-Length: 148
ETag: W/"94-gchvqzo1EaX4rE/cW69nfX45DYI"
Date: Wed, 24 Apr 2019 16:32:57 GMT
Connection: keep-alive

File stats: 16:30:24 GMT

stat ./data/upload/buildings.mbtiles
File: ./data/upload/buildings.mbtiles
Size: 1171456       Blocks: 2288       IO Block: 4096   regular file
Device: 801h/2049d  Inode: 922042      Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1001/    tile)   Gid: ( 1002/    tile)
Access: 2019-04-24 16:30:24.625221481 +0000
Modify: 2019-04-24 16:30:24.573217182 +0000
Change: 2019-04-24 16:30:24.573217182 +0000

But after docker restart ... it really shows correct date 16:30:24 GMT:

curl --head localhost:8080/data/buildings/14/9569/5517.pbf
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/x-protobuf
Content-Encoding: gzip
Last-Modified: Wed, 24 Apr 2019 16:30:24 GMT
Content-Length: 148
ETag: W/"94-gchvqzo1EaX4rE/cW69nfX45DYI"
Date: Wed, 24 Apr 2019 16:38:21 GMT
Connection: keep-alive
vipyoung commented 4 years ago

The SIGHUP signal doesn't seem to be intercepted at all by tileserver-gl. I'd start the server with docker: docker run --rm -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl -c config.json --verbose

Then I'd add/remove some styles from config.json

Next run: docker kill --signal=SIGHUP ad038a6c9eaf (# where ad038a6c9eaf is the containerId) but nothing happens. New styles are not added and nothing is logged into tileserver-gl terminal which makes think the signal is not going through. Is there anything I'm doing wrong? PS: I tried both the official docker hub tileserver-gl v2.5.0 and a locally built image (v3.0.0) with same behaviours.