More tweaks for the letter avatar proxy config

This commit is contained in:
Matt Palmer 2015-10-09 08:45:09 +11:00
parent ab2e9a0beb
commit 952d07599a

View file

@ -173,7 +173,7 @@ server {
# This big block is needed so we can selectively enable # This big block is needed so we can selectively enable
# acceleration for backups and avatars # acceleration for backups and avatars
# see note about repetition above # see note about repetition above
location ~ ^/(letter_avatar|user_avatar|highlight-js|stylesheets|favicon/proxied) { location ~ ^/(letter_avatar/|user_avatar|highlight-js|stylesheets|favicon/proxied) {
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -192,9 +192,23 @@ server {
break; break;
} }
location /letter_avatar_proxy { location /letter_avatar_proxy/ {
rewrite /letter_avatar_proxy/(.*)$ /$1 break; # Don't send any client headers to the avatars service
proxy_pass https://avatars.discourse.org; proxy_method GET;
proxy_pass_request_headers off;
proxy_pass_request_body off;
# Don't let cookies interrupt caching, and don't pass them to the
# client
proxy_ignore_headers "Set-Cookie";
proxy_hide_header "Set-Cookie";
proxy_cache one;
proxy_cache_key $uri;
proxy_cache_valid 200 7d;
proxy_cache_valid 404 1m;
proxy_pass https://avatars.discourse.org/;
} }
# this means every file in public is tried first # this means every file in public is tried first