Prevent access to index.json

I don’t know if this is a hugo question or more related to hosting (I’m using aws s3).

I’m generating an index.json file for search and I would like to prevent users from accessing the file by going to http://mysite.com/index.json.

I think it’s a hosting issue. Using apache, you could put a line in .htaccess or your robots.txt to try to avoid having people access that file. Using AWS S3, it’s perhaps a matter of accessing the file and setting security on it?

This is how to allow it:

https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteAccessPermissionsReqd.html

So perhaps setting a less permissive setting will allow you to block that one file. Not sure, sorry.

What type of search is it? Server-side or client?

For what?

There’s a UI for redirects in S3:

https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html

Thanks for the input. I’m using Algolia instantsearch.js for search.