-
Notifications
You must be signed in to change notification settings - Fork 16
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
Non standard S3 endpoint download url issue #21
Comments
I had a similar issue in a project of mine. The solution was to patch Shrine's Here's the patch I applied in my local code to get Shrine working with Digital Ocean Spaces. I still have a lot on my plate at the moment, so if someone else wants to turn this into a PR that would be great 😄 # TRICKY: we patch this because it's not providing the correct download url
class Shrine
module Storage
class S3 < Storage::Base
def url(id : String, **options) : String
endpoint : String?
if ep = client.@endpoint
endpoint = ep.gsub("https://", "")
end
presigned_options = Awscr::S3::Presigned::Url::Options.new(
aws_access_key: client.@aws_access_key,
aws_secret_key: client.@aws_secret_key,
region: client.@region,
object: "/#{object_key(id)}",
bucket: bucket,
host_name: endpoint
)
url = Awscr::S3::Presigned::Url.new(presigned_options)
url.for(:get)
end
end
end
end |
Thanks that will help massively! I will add it into my project and if I get chance turn it into a PR 😀 |
I tried adding this into my project but unfortunately it still didn't work for me. The problem seemed to be partly that the awscr-s3 shard only supports https endpoints. While I can understand this, it makes it a lot harder to run a local Minio server in development. I will keep working on a solution and potential end up submitting a couple of pull requests... |
What do you think of this diff: nikobojs@c5a3677 |
In that case, you're probably better off using Ngrok or something for your local minio server, so you run it over https. |
Hi,
I could be wrong but I think there is a problem with generating a url for an uploaded file when using a custom s3 storage endpoint. I am running Minio locally on my machine and uploading works fine. Unfortunately, when I try to request a download url via
UploadedFile#url
I get a url that doesn't point to my local Minio server.I am using it within a Lucky project. Below is my configuration and usage.
As you can see from the above, I have my endpoint configured to
http://localhost:9000
but when I request a url it useshttps://s3-minio.amazonaws.com
.Am I doing something wrong or is this a bug? Any help would be appreciated!
The text was updated successfully, but these errors were encountered: