Initial commit

This commit is contained in:
zhongjin
2020-06-15 10:58:47 +08:00
commit 4f1dfe7564
8590 changed files with 1516878 additions and 0 deletions
@@ -0,0 +1,26 @@
module Carto
module Api
class ImageProxyController < ::Api::ApplicationController
ssl_required :show
def show
# image url
url = params[:url]
render :status => 404 if url.blank?
# fetch the image
http_client = Carto::Http::Client.get('image_proxy', log_requests: true)
response = http_client.get(url, followlocation: true, timeout: 3)
if response.code == 200
send_data response.response_body, type: response.headers['Content-Type'], disposition: 'inline'
else
render :status => 404
end
end
end
end
end