Posts

Showing posts from March, 2012

Utilizing Page Caching while using query string parameters using Nginx

One of the common practices for ruby on rails developers is to wrap all parameters in the URI itself, so they can easily make use of page caching. Sometimes having a lot of parameters can start being confusing specially with the ordering of the parameters to match the defined routes. Let's elaborate with an example. Consider an API that provides a list of entries, with possible filters: http://api.example.com/feed.json This can simply be page cached, rails will place the proper feed.json file in the public directory. If we wanted to add use some supported filters like: date (in the format of 2012-03-25) order (by date, score or relevance) page (used to get the next pages of the feed) limit (or the page size.. the expected number of entries per response) type (some app related filter. let's assume the values can be: post, comment, announcement) If we used the simply form of http://api.example.com/feed.json?date=2012-03-25&page=2&limit=20&type=comment&order=score