server {
  listen 80;

  client_max_body_size 100M;

  location / {
    proxy_pass http://photolist:8080/;
  }

  location /notexist {
    return 404 "Page not found";
  }

  location ~* ^/images/(\d+)/(.*) {
    rewrite ^/images/(\d+)/(.*) /photolist/$2 break;

    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_read_timeout 15m; # Default value is 60s which is not sufficient for MinIO.
    proxy_send_timeout 15m; # Default value is 60s which is not sufficient for MinIO.
    proxy_request_buffering off; # Disable any internal request bufferring.
    proxy_set_header Host $http_host;

    proxy_hide_header      x-amz-request-id;
    proxy_hide_header      x-amz-meta-user-id;

    proxy_pass http://minio:9000;
  }

}
