From time to time, the services on our ArcGIS server will not be available, and when requesting tiles, I will get a 'invalid url'. This is okay, sometimes it is scheduled downtime, maintenance or just some of our server scripts not bringing the services up again.

We also have a cache server in front of the ArcGIS server, that can serve often requested tiles really fast, w/o sending the request to the server.

The cache server is set up to store the successful requests for a period of time. The thing that bothers me, is that the page 'invalid url' is served with the http code OK 200, and thus making our cache server store it.

Of course, I could make exceptions, probably based on mime-type or something, but that's not the optimal solution.

Example of the invalid url page

I would actually like to know if it is possible to alter the 'invalid url' error page, with another http code, such as Bad request 400 or Not implemented 501, both which would make Varnish behave.

EDIT: I should mention that the ArcGIS server runs in a .NET environment.

  • What GIS web map application is your service running on, flex, silverlight, java, other...?
    – artwork21
    Feb 6, 2012 at 13:36
  • With IIS6/7 you can create you own custom error page when an invalid link is detected.
    – Mapperz
    Feb 6, 2012 at 14:46
  • @artwork21 Most of our services are based on the javascript api, running on other servers... Getting an invalid url error can happen time to time in our setup, and we want the proper http error code..
    – Ragnar123
    Feb 6, 2012 at 17:53
  • @Mapperz Yes, we are running IIS7. How do I detect an invalid url in IIS? I would expect a 404 from the application, but it seems like the ArcGIS rest service is serving the OK 200 message along with the custom invalid url page. Could you elaborate on the invalid url detection?
    – Ragnar123
    Feb 6, 2012 at 17:56
  • Ragnar123 stackoverflow.com/questions/1060878/…
    – Mapperz
    Feb 6, 2012 at 19:28

1 Answer 1


The JSON response from the server should contain an error object (in JSON) that you might be able to use to tell your cache server to dismiss.

I wasn't able to match your "Invalid URL" using ESRI's online servers, but got a similar light-pink error with the following URL:


Which, if you request asking for JSON will give you this:


If you wanted to be extra sneaky, set up an HTTP filter in IIS that transforms the 200 OK response into a 400 bad request response if the error object is detected in the response body.

  • sampleserver4.arcgisonline.com/ArcGIS/rest/services/Elevation/… - link to a invalid url from the sampleserver. However, both of the links you sent were sent with the http code 200 ok, meaning that our cache server will store it... As we're dealing with image tiles, JSON will probably be out of the question. I will try to look into http filters.
    – Ragnar123
    Feb 6, 2012 at 19:44
  • Yes, if you're not requesting JSON directly then you could watch for the text "<div class="restErrors"> Invalid URL<br/>"
    – mwalker
    Feb 6, 2012 at 20:07
  • Yes, but the problem is that the errors (they are temporary, but can occur on a fairly regular basis) are stored by our cache server. As I would rather NOT like to write such special rules (if even possible) into the caching logic. The answer I am looking for is altering either the IIS server or the ArcGIS server to serve the errors with proper http codes - and thus forcing our cache server pass the content.
    – Ragnar123
    Feb 6, 2012 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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