Protecting Images and Tracking Rails

I made an example application with design and facebook auth. I want to show fb profile photo as a user avatar and it works in Chrome and IE. But in firefox, I see a warning “Tracking Protection” - “Connection is not secure.”

I wrote a simple method:

def avatar_for(user) avatar_url = user.image image_tag(avatar_url, alt: user.name, class: "avatar") unless user.image.nil? end 

How can I make this method / connection safe?

EDIT: that’s exactly how Max wrote: using the https address vis secure_image_url removes the warning in the “Tracking Protection” section of the warning in Firefox, but the image does not appear.

+7
security ruby ruby-on-rails
source share
1 answer

Use the secure_image_url parameter to have OmniAuth Facebook create an HTTPS address:

 Rails.application.config.middleware.use OmniAuth::Builder do provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], secure_image_url: true end 
+6
source share

All Articles