Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.