Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
server {
listen 80;
location / {
proxy_cache images;
proxy_cache_valid 200 ${PROXY_CACHE_VALID_200};
proxy_cache_key “${DOLLAR}scheme://${DOLLAR}host${DOLLAR}request_uri${DOLLAR}is_args${DOLLAR}args”;
proxy_pass http://small_light_server;
}
# TODO ngx_small_lightがwebpファイルを処理出来ないのでそのままプロキシする。
location ~ ^/${URL_PREFIX}([0-9]+)x([0-9]+)/([^/]+)/(.+\.webp)${DOLLAR} {
set ${DOLLAR}width ${DOLLAR}1;
set ${DOLLAR}height ${DOLLAR}2;
set ${DOLLAR}quality ${DOLLAR}3;
set ${DOLLAR}file ${DOLLAR}4;
expires ${EXPIRES};
add_header Pragma public;
add_header Cache-Control "public";
resolver 8.8.4.4 8.8.8.8 valid=300s;
resolver_timeout 10s;
set ${DOLLAR}s3_bucket "${S3_BUCKET}";
proxy_http_version 1.1;
proxy_set_header Host ${DOLLAR}s3_bucket;
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_buffering off;
proxy_intercept_errors on;
proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;
proxy_pass http://${DOLLAR}s3_bucket/${S3_DIR_PREFIX}${DOLLAR}file;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.