Amazing nginx JSON hacks – via Gabriel Weinberg’s Blog

Nginx talk HTTP and REST api talk HTTP so making them collaborate is very easy.

  • proxying: you can set up a http proxy to an external api via your server. The client side can do call to your server with all the remote / proxyied api methods
  • caching: this way you can follow external api rate limits with caching request on your nginx
  • timeout: you can degrade with a short timeout: better than letting the user waiting more than 30 seconds
  • private keys: your js code don’t embed private api key, its rewritten / added on the fly by nginx.
  • json to jsonp: rewrite the api response to make it jsonp allowing cross site calls

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">