[mapserver-users] Adding cache control headers to wms requests

Lime, Steve D (MNIT) steve.lime at state.mn.us
Fri Jul 5 12:43:03 PDT 2019


I guess the question is whether this belongs in MapServer or if it should be done at the web server level - you shouldn't need to write a wrapper process. The mod_headers module provides this for Apache and since you can use the module in any container (e.g. <If></If>) you could set headers based on things like the value of the map parameter or the WMS request type. I would guess other web servers provide similar functionality but I don't know that for sure. That seems extremely flexible IMHO.

Currently the setting max-age is supported in 3 spots within MapServer: WMS/GetMap (1), mode=map (2) and mode=legendicon (3) CGI requests. Other request responses don't look for or set it and probably should in a more general solution.

--Steve

-----Original Message-----
From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephen Woodbridge
Sent: Thursday, July 04, 2019 10:16 AM
To: mapserver-users <mapserver-users at lists.osgeo.org>
Subject: [mapserver-users] Adding cache control headers to wms requests

Hi all,

I need to add the following headers to some wms responses:

|Cache-Control: no-cache, no-store, must-revalidate Pragma: no-cache
Expires: 0 I am aware that I can set: MAP WEB METADATA ...
"ows_http_max_age" "0" END END ... END But it seems like it would be a
good idea to be able to set additional headers also. Maybe something
like: WEB HEADERS "||Cache-Control: no-cache, no-store, must-revalidate|"
     "|Pragma: no-cache|"
     "Expires: 0"
   END
   METADATA
     ...
   END
END

This would provide an easy way to add arbitrary response header.
The various headers are because browsers are not consistent which headers they respond to.
See||   https://stackoverflow.com/questions/49547/how-do-we-control-web-page-caching-across-all-browsers

||
Maybe we can already do this and I'm not aware of how. I could write a wrapper around mapserver and
funnel some requests through it to do this, but it would be nice if mapserver via the mapfile can do it.

Thoughts?

-Steve W


---
This email has been checked for viruses by Avast antivirus software.
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.avast.com%2Fantivirus&data=02%7C01%7Csteve.lime%40state.mn.us%7C1af86007bc1f4912624008d7009286dc%7Ceb14b04624c445198f26b89c2159828c%7C0%7C0%7C636978501633400154&sdata=AdIpAUJ50fRgV5qyalgsGa%2BVvJzoTezeeL%2BdvCXWGJ4%3D&reserved=0

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fmapserver-users&data=02%7C01%7Csteve.lime%40state.mn.us%7C1af86007bc1f4912624008d7009286dc%7Ceb14b04624c445198f26b89c2159828c%7C0%7C1%7C636978501633410140&sdata=vQFd1f%2BWlo%2Bc5Hf651WMklqv9%2B5fmPWuLYX%2B0RHZkM8%3D&reserved=0


More information about the mapserver-users mailing list