[OpenLayers-Dev] Caching layerimages by browsers
Dipl. Inf. Carsten Eider
eider at fh-bingen.de
Fri Mar 5 08:14:50 EST 2010
Hi Tim,
unfortunately I have no influence on the servers I get my images from.
THX Carsten
Am 04.03.2010 20:06, schrieb Tim Schaub:
> Hey-
>
> Dipl. Inf. Carsten Eider wrote:
>
>> Hi list,
>>
>> while examining my WMS-Servers logs i was surpprised by the amount of
>> WMS-requests I found within.
>> Using Firefox and Firebug i recognized, that the tiles were not cached
>> by the browser, i.e.
>> each time they came into the viewport of the map they were re-requested!
>>
>> Is there a way to use cached images by the browser instead of requesting
>> them time and again?
>>
>>
> Caching is best controlled by using the appropriate headers in your
> server responses.
>
> If your server responds with an Expires header, we can't force the
> browser to use a cached image (without essentially rewriting our own
> cache) if the Expires date has been reached.
>
> If your server (or gateway cache) uses Etag or Last-Modified headers,
> the browser will try to make requests with If-None-Match or
> If-Modified-Since headers. If the server responds with 304, Not
> Modified, the browser will pull from its cache.
>
> Looking at the http://openlayers.org/dev/examples/example.html example,
> you can see Etag headers on the static images (west-mini.png etc.). The
> GetMap responses from openlayers.org contain Expires headers
> corresponding to the request time (so they immediately expire). The
> GetMap responses from www2.dmsolutions.ca don't contain any cache
> related headers.
>
> When you refresh the page, requests for static images return 304, Not
> Modified, and the browser pulls those from its cache. Previous
> responses for GetMap images make the browser think those should not be
> cached, so they are requested with Cache-Control: max-age=0. We can't
> override the headers in this case, so if your server obeys, it will do
> whatever it does to generate new GetMap responses.
>
> So, you can improve the caching situation by having your server (or
> gateway cache) use appropriate headers on responses. If you configure a
> gateway cache like Varnish or Squid in front of your WMS, this should be
> handled for you. If you use a tile generator to pre-seed a tile cache
> and serve those statically, you can configure your server to use
> Last-Modified headers. If you are confident that you won't be updating
> static images, use future Expires headers to avoid the intermediate
> request with If-None-Match or If-Modified-Since headers.
>
> The short story is that for image requests and effectively using the
> browser's cache, OpenLayers isn't the place to make changes.
>
> Oh, and re-reading your question, I see you were talking about
> panning/zooming instead of reloading the page. The same advice applies,
> with the additional note that your browser cache can eventually fill up.
> I think the default configuration for Firefox is 50MB.
>
> Hope that is some help.
> Tim
>
>
>> THX
>> Carsten
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev
>>
>
>
--
Mit freundlichen Grüßen / Yours faithfully
Carsten Eider
Dipl. Inf. (FH)
Kompetenzzentrum für Innovative Informationssysteme
c/o Fachhochschule Bingen / University of applied sciences Bingen
Berlinstraße 109
55411 Bingen
Tel: +49 (0) 6721 / 409-179
Fax: +49 (0) 6721 / 994-251
email: eider at fh-bingen.de
Internet: iis.fh-bingen.de
Diese E-Mail, inklusive anhängender Dateien, kann vertrauliche und/oder rechtlich geschützte Inhalte enthalten.
Wenn Sie nicht der richtige Adressat sind und diese E-Mail irrtümlich erhalten haben, benachrichtigen Sie bitte sofort den Absender und vernichten Sie sodann die Originalnachricht.
Die unbefugte Kopie, Weiterleitung oder sonstige Verbreitung dieser Nachricht ist nicht gestattet.
This e-mail, including attachments, may contain confidential and/or privileged information.
If you are not the intended recipient, please notify the sender immediately then delete the original message.
Any copying forwarding and/or distribution without permission of the sender is forbidden.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eider.vcf
Type: text/x-vcard
Size: 1142 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20100305/a1f71247/eider.vcf
More information about the Dev
mailing list