简体   繁体   中英

Ruby on Rails assets/images are accessible to users not logged in

When I load an image link into the URL it loads the images even if the person is not logged in.

For example,

this link takes me to login: website.net

this link takes me to an image file (without logging in) website.net/assets/idaho/idaho_ellen_mitchell_sig.png

I don't want that image file to load if the user isn't logged in.

I'm new to RoR and am really unsure where to start with this problem.

Is this a sessions issue? Security issue?

My gut tells me I'll need to use NGINX to make this work.

Any help is appreciated!

Your Problem is, that you placed your images in the assets folder, which is public. You can solve your problem with the Paperclip gem.

The documentation is great and you will surely find your way around it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM