2

I am writing a service which will perform HTTP redirects. E.g.

GET /key/0CC175B9C0F1B6A831C399E269772661 HTTP/1.0

response

HTTP/1.0 301
Location: http://some-url/92EB5FFEE6AE2FEC3AD71C777531578F

This will be backed by a key-value store and will store a few million items.

Of course, the server part is simple to implement, but to reduce the number of services running I'm looking for a key-value store that will do the web serving for me.

Is there a key-value store that will such a public-facing web service?

  • A key-value-store to address how? From Java, PHP, Python…? – Izzy Aug 23 '16 at 18:12
  • Preferably from Java, but I was hoping something matching the bill would have an HTTP interface. – Joe Aug 23 '16 at 22:01
  • Azure Storage Tables sounds like a match. Cheap as chips, fast as a rocket if partitioning is selected correctly. – trailmax Aug 22 '17 at 9:46
  • Thanks @trailmax I'll take a look. – Joe Aug 22 '17 at 14:30
1

Firebase Remote Config could possibly do this. https://firebase.google.com/docs/remote-config

1

If I were given this task I would turn to Openresty, you do not even need the whole shebang, just lua-nginx-redis driver for lua-nginx-module, under Ubuntu/Debian installing lua-nginx-redis will install all the nginx parts you need. And of course you'll need Redis. This tutorial is extremely close - it does an internal redirect based on the user agent. Turning that into an external redirect based on the request URI is not hard.

It starts the process with local key = ngx.var.http_user_agent you'd need to change local key = ngx.var.http_user_agent to local key = ngx.var.uri. You can remove the set $target ''; bit.

At the end instead of ngx.var.target = host just do return ngx.redirect($target). You can remove proxy_pass http://$target; as it will never be reached.

I would be hard pressed to name a disadvantage of this solution. Openresty is well maintained and extremely fast. Redis is known to be of excellent quality, too. The amount of code / config to maintain is really as little as it can be.

  • Yeah, Redis was the first thing that came to my mind – Chris Rasys May 23 '17 at 14:37
0

CouchDB - (key, document) rather than (key, value) but can still do what you want and supports Master/Master replication cluster too for high avail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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