Ok guys, here we go !
For my needs, I basically added a standalone version of GeoWebCache.
After some configuration, the GeoWebCache retrieve the data from GeoServer using Capabilities.
Now, in my OpenLayers code, I would like to question GeoWebCache to retrieve my data, and not GeoServer (if it is possible).
For the moment, I have something like this (working) :
var fond_carto = new OpenLayers.Layer.WMS(
"Fond cartographique 2",
"http://179.172.277.77:8080/geoserver/wms",
{
layers: 'departement',
TILED: 'true'
}
I tried stuff like that (not working) :
var fond_carto = new OpenLayers.Layer.WMS(
"Fond cartographique 2",
"http://179.172.277.77:8080/geowebcache/sevice/wms",
{
layers: 'departement',
TILED: 'true'
}
Is there a way to accomplish that ?
After some reading, I assume I'm a bit lost with this standalone version of GeoWebCache. It is written it works as a proxy between client (OpenLayers) and server (GeoServer). But I read that the TILED: 'true' option means that GeoServer will send the layers for tiling to GeoWebCache. As I desactivated the integrated version of GeoWebCache in GeoServer, and as my WMS request are still tiled, I assume this is true. But then it's not really a proxy.
Could it works as follow:
openlayers => standalone geowebcache => geoserver => standalone geowebcache => openlayers
Or it has to work that way :
openlayers => geoserver => standalone geowebcache => geoserver => openlayers
Thanks for any tips or any clarifications 🙂 !
EDIT
After some more configuration in geowebcache.xml, I still have the error but I can add some details to help.
This is the URL of the request that is not displaying (pink tiles) :
http://179.172.277.77:8088/geowebcache/sevice/wms?LAYERS=departement&TILED=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=2.8125,48.515625,3.515625,49.21875&WIDTH=256&HEIGHT=256:8080/geowebcache/sevice/wms?LAYERS=departement&TILED=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=2.8125,48.515625,3.515625,49.21875&WIDTH=256&HEIGHT=256 :
and when I try to copy/paste this url, I got a GWC error :
400: Thread 35 Unknown layer departement. Check the logfiles, it may not have loaded properly.
I don't get why I got this error. Here's my geowebcache.xml description of the layer :
<wmsLayer>
<name>departement</name>
<mimeFormats>
<string>image/gif</string>
<string>image/jpeg</string>
<string>image/png</string>
<string>image/png8</string>
</mimeFormats>
<gridSubsets>
<gridSubset>
<gridSetName>EPSG:4326</gridSetName>
</gridSubset>
</gridSubsets>
<wmsUrl>
<string>http://179.172.277.77:8080/geoserver/wms</string>
</wmsUrl>
<wmsLayers>aaz:departement</wmsLayers>
</wmsLayer>
Best Answer
Your Geoserver Instance and GeoWebCache should be running on different ports if on the same machine.
Then your GeoWebCache end point should be something like:
The flow is Openlayers => Standalone GeoWebCache => GeoServer
EDIT: (For Additional Question)
You look like you are using workspace aaz so your reference to the layer in geoWebCache should be aaz:departement not departement