Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am confused how can I use it for s3 images? #413

Open
milanpoudelwebdeveloper opened this issue Apr 13, 2024 · 1 comment
Open

I am confused how can I use it for s3 images? #413

milanpoudelwebdeveloper opened this issue Apr 13, 2024 · 1 comment
Labels
question Further information is requested

Comments

@milanpoudelwebdeveloper

is it same as adding https://wsrv.nl/?url=s3 image url....? I am getting 404 this way

@kleisauke kleisauke added the question Further information is requested label Apr 13, 2024
@kleisauke
Copy link
Member

Images on public S3 buckets can be reached via <bucket-name>.s3.<region>.amazonaws.com, for example:
https://wsrv.nl/?url=https://libvips-packaging.s3.eu-west-1.amazonaws.com/zebra.jpg

Private S3 buckets requires HTTP basic authentication which is not something we'd support on our public service (see #341). If you're able to host your own solution, you can support this by doing something like this within the ngnix configuration:

location /s3/ {
    weserv filter;

    # The S3 bucket we use
    proxy_pass http://libvips-packaging.s3.amazonaws.com/;
    proxy_set_header Host libvips-packaging.s3.amazonaws.com;

    # Authorization should not be needed on public buckets
    proxy_set_header Authorization '';

    # Header configuration
    proxy_hide_header x-amz-id-2;
    proxy_hide_header x-amz-request-id;
    proxy_hide_header x-amz-meta-server-side-encryption;
    proxy_hide_header x-amz-server-side-encryption;
    proxy_hide_header Set-Cookie;
    proxy_ignore_headers Set-Cookie;

    # Intercept proxy errors
    proxy_intercept_errors on;

    # Enable the upstream persistent connection
    proxy_http_version 1.1;
    proxy_set_header Connection '';
}
$ curl -s -o /dev/null -w "%{http_code}" http://localhost/s3/zebra.jpg?w=512
200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

2 participants