Last active
August 1, 2017 16:27
-
-
Save gambala/b43c22869aeb065df9a57681bc3d10bc to your computer and use it in GitHub Desktop.
http://images inside https://site with proxying in nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def http_url(url) | |
return url if Rails.env.development? | |
"/http_proxy?url=#{url}" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instead of this | |
= image_tag 'http://site.com/image.jpg' | |
# We use this | |
= image_tag http_url('http://site.com/image.jpg') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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