Route png requests to Elixir app and cache it good
This commit is contained in:
parent
5f710f5589
commit
4c36197876
@ -62,3 +62,4 @@ services:
|
||||
- ./uploads:/app/uploads
|
||||
- ./log:/app/log
|
||||
- /tmp/asciinema-web:/tmp
|
||||
- ./volumes/cache:/cache
|
||||
|
@ -10,6 +10,9 @@ upstream clj-server {
|
||||
server 127.0.0.1:5000 fail_timeout=0;
|
||||
}
|
||||
|
||||
proxy_cache_path /cache levels=1:2 keys_zone=png_cache:10m max_size=10g
|
||||
inactive=14d use_temp_path=off;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
@ -25,7 +28,19 @@ server {
|
||||
}
|
||||
|
||||
location ~ ^/a/[^.]+\.png$ {
|
||||
try_files $uri $uri/index.html $uri.html @clj;
|
||||
proxy_cache png_cache;
|
||||
proxy_cache_revalidate on;
|
||||
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
||||
proxy_cache_lock on;
|
||||
proxy_cache_key $uri;
|
||||
proxy_ignore_headers Set-Cookie;
|
||||
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_pass http://phoenix-server;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location ~ ^/a/[^.]+\.(json|gif)$ {
|
||||
|
Loading…
Reference in New Issue
Block a user