Guard/Restrict access to asset files


#1

Hello, is there a way to restrict certain asset folders or files (images, audio, etc.) from being viewed from the public browser url?

For example, if there is a uploads directory that is not a collection and it has a file named image1.jpg. The file can be directly viewed by going to domain.com/uploads/image1.jpg. Is there a way to prevent this from happening while also being able to reference the image within the jekyll pages? Thanks in advance!


#2

what is the reason? on the server you can tell it to only serve the image if the referral is your site - which disallows hot linking (where your image is embeded on another site). So it would still display on your site, but I wouldn’t be able to show it on my site.

I do this on AWS S3 on one site, can’t remember if it also disallows that you are asking for - it might. I can’t remember where I did it exactly.


#3

@rdyar The reason is we’re trying to see if we can implement private asset file/folders (folders of images/audio/any other static files) within jekyll and without a server.


#4

that is kind of what I did. Google disable hot linking s3 and see what you find. I also had expiring urls which I used a server to create, though now you could use lambda i’m sure.

jekyll itself isn’t going to do any of this for you.