-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Hi there,
I am running into an issue that is quite strange. I am using this gem as a stand alone gem and it seems that my imgproxy server wont accept the "advanced" url scheme:
I am using the following code (pulled from: https://github.com/imgproxy/imgproxy/blob/master/examples/signature.rb) which is generating a working, basic url
def self.generate_url(url,
width: 250,
height: 250,
resize: "fit",
gravity: "no",
enlarge: 1)
key = [Rails.application.secrets.IMGPROXY_KEY].pack("H*")
salt = [Rails.application.secrets.IMGPROXY_SALT].pack("H*")
encoded_url = Base64.urlsafe_encode64(url).tr("=", "").scan(/.{1,16}/).join("/")
path = "/#{resize}/#{width}/#{height}/#{gravity}/#{enlarge}/#{encoded_url}"
digest = OpenSSL::Digest.new("sha256")
hmac = Base64.urlsafe_encode64(
OpenSSL::HMAC.digest(digest, key, "#{salt}#{path}")
).tr("=", "")
URI.join(Rails.application.secrets.IMGPROXY_HOST, "/#{hmac}#{path}").to_s
end
If I update this code to the "advanced" url scheme (https://github.com/imgproxy/imgproxy/blob/master/docs/generating_the_url_advanced.md) I get an "Invalid Signature" error.
Interestingly I also am getting the "Invalid Signature" error when generating a URL using this gem
# config/initializers/imgproxy.rb
Imgproxy.configure do |config|
config.endpoint = Rails.application.secrets.IMGPROXY_HOST
config.hex_key = Rails.application.secrets.IMGPROXY_KEY
config.hex_salt = Rails.application.secrets.IMGPROXY_SALT
end
# console
> Imgproxy.url_for("https://i.scdn.co/image/a41a79bccd8165b0a4c3d0de9979d973ca8cb321")
=> "http://localhost:1337/Ujm6eYWQ8lJIsjBgT6vuSE742OvVvEfmBus7E9cmHYA/plain/https:/i.scdn.co/image/a41a79bccd8165b0a4c3d0de9979d973ca8cb321"
Can anyone confirm they are also getting this error using the advanced url scheme in Ruby and/or using this gem?
Using version 2.3.0 of imgproxy btw
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels