Ticket #579 (closed enhancement: wontfix)

Opened 6 years ago

Last modified 8 months ago

API should honour conditional If-Modified-Since HTTP GET

Reported by: openstreetmap@… Owned by: rails-dev@…
Priority: minor Milestone:
Component: api Version:
Keywords: If-Modified-Since Caching Cache Cc:

Description

As cheaply as possible the API should honour conditional If-Modified-Since HTTP GET. (Maybe initially only on: /api/0.5/map?bbox=)

If-Modified-Since header definition:  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.25

Rails Code example:  http://www.igvita.com/blog/2007/03/07/client-http-caching-in-rails/

This would allow more intelligence in downstream clients. Eg: TilesAtHome? having the ability to only run a full API map GET request and re-render if the tile/area has actually been modified.

This paves the way for "freshness" validated caching.

Blocked By: Bug #578

Change History

comment:1 Changed 6 years ago by tom@…

Now you're just taking the piss! There is no way on earth that this is likely to get done anytime soon...

comment:2 Changed 6 years ago by openstreetmap@…

  • Priority changed from major to minor

Apologies if I am being loon. Resolve -> wontfix is suitable then.

OK, working out when a ways or relations within a bounding box has changed is difficult (and costly)

How about the following...

Create new db table storing last modified time of layer 12 tiles. Kept updated by using a mysql trigger on db tables; current_nodes, current_way_nodes and current_relation_members.

On a API map request without an If-Modified-Since: the bounding box is normalised to find the layer 12 tiles it applies to, selecting the MAX modified time and using this as the Last-Modified time.

On a API map request with an If-Modified-Since: If-Modified-Since time is compared to bounding box layer 12 tiles' MAX modified time. If MAX modified time <= If-Modified-Since short circuit ELSE proceed with normal request.

Shared proxy-cache in front of web would result in most request being If-Modified-Since conditional request. Rounding bounding boxes requests up to semi standard sizes could result in worthwhile cache hits.

Conditional GET Usage example:

  • T@H client downloads map (layer 12) and renders, storing Last-Modified time returned by API, subsequent T@H client API Map download of that tile would be If-Modified-Since conditional based request using previous stored Last-Modified time.

comment:3 Changed 3 years ago by TomH

  • Owner changed from tom@… to rails-dev@…

comment:4 Changed 8 months ago by iandees

  • Status changed from new to closed
  • Resolution set to wontfix

The API will have to work just as hard to check modification dates as it would to return the entire result.

Note: See TracTickets for help on using tickets.