A proxy to enable privacy and TLS for images on the web.
Privacy Please uses the same URL structure and signature method as camo so it can work as a drop-in replacement.
- Ruby 2.7
git clone https://github.com/feedbin/privacy-please.git
cd privacy-please
bundle install
PRIVACY_KEY=secret bundle exec foreman start
Configuration is available through environment variables.
PRIVACY_KEY
The encryption key used to sign URLs
Optional variables
RACK_ENV
development
(default) orproduction
PORT
which port to run onMAX_THREADS
puma tuningWEB_CONCURRENCY
puma tuning
Replace img[src]
, video[poster]
etc… with the proxied url
require "openssl"
ENV["PRIVACY_KEY"] = "secret"
image_url = "http://example.com/image.jpg"
signature = OpenSSL::HMAC.hexdigest("sha1", ENV["PRIVACY_KEY"], image_url)
hex_url = image_url.to_enum(:each_byte).map { |byte| "%02x" % byte }.join
# The proxied image will be available here:
"http://localhost:5000/#{signature}/#{hex_url}"