Skip to content

Instantly share code, notes, and snippets.

@nm-harry
Created July 14, 2017 14:16
Show Gist options
  • Save nm-harry/d512599242ee849f542d7b60df0d65b0 to your computer and use it in GitHub Desktop.
Save nm-harry/d512599242ee849f542d7b60df0d65b0 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name www.superwebsite.com;
root /var/www/html;
set $skip_cache 0;
if ($uri ~* ^/refinery) {
set $skip_cache 1;
}
if ($request_method = POST) {
set $skip_cache 1;
}
location ~* ^/refinery {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_pass http://refinery;
}
location / {
# Cache options
proxy_cache client_cache;
proxy_cache_revalidate on;
proxy_cache_lock on;
proxy_cache_valid 200 302 301 5m;
# ?nocache=true bypass the cache
proxy_cache_bypass $skip_cache $arg_nocache;
# Ignore origin server headers for caching
proxy_ignore_headers Cache-Control;
proxy_ignore_headers Set-Cookie;
# Hide origin server headers in response
proxy_hide_header Cache-Control;
proxy_hide_header Set-Cookie;
proxy_hide_header X-Request-Id;
proxy_hide_header X-Runtime;
# Origin server
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_pass http://refinery;
}
upstream refinery {
server 127.0.0.1:3000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment