2

I am creating a rule for S3, with Rewrite Querystring to Path with file Requests from the browser to the server can be

http://localhost:8088/bucket-media/1111111_0.jpg?size=large

"size" is a directory in the s3 bucket, it needs to be proxied to S3

https://s3-storage/bucket-media/large/1111111_0.jpg

My config

set $bucket "s3-storage";
location /bucket-media/ {
    #set $size $arg_size;
    #rewrite ^ /$size$uri break;
    if ($args ~* "size=(.*)") {
        set $w1 $1;
        rewrite .* /bucket-media/$w1/$uri break;
    }
    proxy_intercept_errors on;
    resolver 8.8.8.8;
    proxy_pass  https://$bucket$uri;
    error_page 404 = @fallback;
}

location @fallback {
    proxy_intercept_errors on;
    proxy_pass http://other-backend/internal/images/missing/?file_name=$uri;
}

It doesn't work right. No filename when proxying.

https://storage/bucket-media/large/
MrWhite
  • 43,179
  • 8
  • 60
  • 84
s2nner
  • 23
  • 1
  • 3

0 Answers0