Skip to content

Instantly share code, notes, and snippets.

@psobot
Created May 9, 2012 03:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psobot/2641616 to your computer and use it in GitHub Desktop.
Save psobot/2641616 to your computer and use it in GitHub Desktop.
API proxying with nginx
proxy_cache_path /tmp/recipe_cache levels=1:2 keys_zone=RECIPE:64m inactive=3600m max_size=360m;
# Yada yada yada...
server {
# Yada yada yada, more in here...
location ^~ /recipes {
rewrite ^/recipes\??(.*) /recipes?key={your_private_api_key_here}&$1 break;
proxy_pass http://api.punchfork.com/;
proxy_cache RECIPE;
proxy_cache_valid 200 204 302 3600m;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment