Skip to content

Instantly share code, notes, and snippets.

@tdgroot
Last active April 10, 2025 15:03
Show Gist options
  • Save tdgroot/d9a79313a2f17e017053da9ed20dea3c to your computer and use it in GitHub Desktop.
Save tdgroot/d9a79313a2f17e017053da9ed20dea3c to your computer and use it in GitHub Desktop.
Example nginx proxy pass configuration on Hypernode
location / {
    set $bucket "main";
    proxy_cache_key "$bucket$uri";
    proxy_cache_valid 200 302 7d;
    proxy_cache_methods GET HEAD;
    proxy_cache_background_update on;
    proxy_cache_use_stale updating;
    # asset_cache is a predefined proxy cache defined in /etc/nginx/conf.d/assets.conf
    # if necessary, feel free to define a different proxy cache
    proxy_cache asset_cache;
    
    # optionally set a resolver when you're using a hostname instead of IP
    # resolver 8.8.8.8 1.1.1.1;
    proxy_pass http://127.0.0.1:5335/$bucket$request_uri;
    proxy_pass_request_body off;
    proxy_pass_request_headers off;
    proxy_intercept_errors on;
    proxy_hide_header "x-amz-id-2";
    proxy_hide_header "x-amz-request-id";
    proxy_hide_header "x-amz-storage-class";
    proxy_hide_header "x-amz-server-side-encryption";
    proxy_hide_header "x-amz-meta-image-height";
    proxy_hide_header "x-amz-meta-image-width";
    proxy_hide_header "x-openstack-request-id";
    proxy_hide_header "x-object-meta-image-height";
    proxy_hide_header "x-object-meta-image-width";
    proxy_hide_header "Set-Cookie";
    proxy_ignore_headers "Set-Cookie";
    
    add_header X-Asset-Cache-Status $upstream_cache_status;
    
    expires +1y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment