Hi,
I'm implementing something like a url shortener, where a large number (tens or hundreds of millions) of url's needs to be handled. The life-time of the url's are unknown, but the normal use pattern will be just one access. So it does not make much sense to store the mapping in a memory database. The database will actually be MongoDB, and the logic to create new mappings and to fetch the real url based on the short one, is contained behind a simple REST (http/json) API.
What I want to do is to use nginx's reverse proxy capabilities, with a little Lua script that sends the requested path (key) to the REST API, gets the original url back, and then let nginx do it's job.
Can you help me understand how this is done in the simplest possible way?
Best regards,
Jarle