Skip to content

Instantly share code, notes, and snippets.

@gambala
Last active August 1, 2017 16:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gambala/b43c22869aeb065df9a57681bc3d10bc to your computer and use it in GitHub Desktop.
Save gambala/b43c22869aeb065df9a57681bc3d10bc to your computer and use it in GitHub Desktop.
http://images inside https://site with proxying in nginx
module ApplicationHelper
def http_url(url)
return url if Rails.env.development?
"/http_proxy?url=#{url}"
end
end
# Instead of this
= image_tag 'http://site.com/image.jpg'
# We use this
= image_tag http_url('http://site.com/image.jpg')
server {
# Other nginx server params
location /http_proxy {
proxy_pass $arg_url;
proxy_set_header host localhost;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment