I have a GeoServer running with a layer that I can load in leaflet using WMS. Currently "caching on demand" seems to work: If I load the map for the second time it loads much faster than loading it for the first time. However I would like to pre seed the map. But it doesn't seem to work: once the map is seeded, it still loads as slow the first time. Then, the second time, as "caching on demand" seems to kick in, it loads faster again. When I inspect the GeoServer data folder, files and folders are created after seeding, so at least tiles are being generated. But after the first request, additional files are created. So to me it looks like preseeding is working, but it does not create all the tiles necessary and so it still needs to create new tiles when I request tiles. Here is a screenshot of the settings that I use in GWC to generate the tiles: enter image description here

The layer is originally defined in SRS EPSG:28992, but it is reprojected to EPSG:900913 as defined in the settings:

enter image description here

I am using the following code using Leaflet to load the map:

  var mymap = L.map('mapid').setView([52.296904, 4.852940], 15);

var wmsLayer = L.tileLayer.wms('http://localhost:8080/geoserver/wms?', 
layers: 'acme:pand',
tiled: true


1 Answer 1


Ok, so I figured out what the problem was: apparently Leaflet was requesting JPEG images while the pre generated images were PNG's. After I changed the image file format from PNG to JPG it worked like a charm! So make sure the file types match if you have a similar problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.