Last active
May 26, 2016 13:34
-
-
Save atarkowska/45ae197d69947af7f6d6b02a583708bb to your computer and use it in GitHub Desktop.
Example of omero web rendering cache for nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy_cache_path /data/omero-cache levels=1:2 keys_zone=omero:200m inactive=30d use_temp_path=off; | |
map $request_uri $skip_cache | |
{ | |
default 1; | |
"~web(client|gateway)/(render)_*" 0; | |
} | |
upstream omeroweb_omero { | |
... | |
server { | |
... | |
location @proxy_to_app_omero { | |
proxy_cache omero; | |
proxy_cache_key $request_uri; | |
proxy_cache_valid 200 30d; | |
proxy_cache_methods GET HEAD; # Only GET and HEAD methods apply | |
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; | |
proxy_cache_bypass $skip_cache; | |
proxy_no_cache $skip_cache; | |
proxy_ignore_headers "Set-Cookie" "Vary" "Expires"; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
# must be turned on for caching | |
# proxy_buffering off; | |
proxy_pass http://omeroweb_omero; | |
# DEBUGGING: TURN OFF ON PROD | |
add_header X-Proxy-Cache $upstream_cache_status; | |
add_header X-Proxy-Cache-Skip $skip_cache; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment