Route png requests to Elixir app and cache it good
This commit is contained in:
parent
1cac231aaa
commit
07fdf2b7f1
@ -62,3 +62,4 @@ services:
|
|||||||
- ./uploads:/app/uploads
|
- ./uploads:/app/uploads
|
||||||
- ./log:/app/log
|
- ./log:/app/log
|
||||||
- /tmp/asciinema-web:/tmp
|
- /tmp/asciinema-web:/tmp
|
||||||
|
- ./volumes/cache:/cache
|
||||||
|
@ -10,6 +10,9 @@ upstream clj-server {
|
|||||||
server 127.0.0.1:5000 fail_timeout=0;
|
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 {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server;
|
listen [::]:80 default_server;
|
||||||
@ -25,7 +28,19 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location ~ ^/a/[^.]+\.png$ {
|
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)$ {
|
location ~ ^/a/[^.]+\.(json|gif)$ {
|
||||||
|
Loading…
Reference in New Issue
Block a user