File access in hosted site with custom domain

#1

Hello,
I have trouble accessing a .rtf file in the www-folder. From this part of the docs, I got the impression that I could serve files too:

( Anything you place in “www” folder can be served as your website, with two exceptions: files that start with an underscore (_) or period (.) are private, and not viewable by visitors.)

And it works. I have a folder ‘files’ and on localhost, I can download the file no problem. Also sitename.vapid.site/files/file.rtf works. However, I’m using a custom domain and customdomain.com/files/file.rtf gives a 404 not found error.

Should I be serving this file some other way? This is literally the only file we need to have on the website, but it would feel cleaner to have it in the /files folder than some external system.

#2

@mxr Anything you put in the www folder (and subfolders) should be accessible, however the file name won’t be preserved. Vapid adds a fingerprint to the file name for caching purposes. For example, /files/file.rtf might turn into /files/file-45d7f644c70be76877821e07ed9d09c3.rtf (the fingerprint/hash will depend on the file’s contents). If you’re linking to the file on the website, the link’s href will be rewritten automatically.

If you’re looking to preserve the file name as file.rtf, it might be better to use Dropbox or the like.

#3

Yes, I noticed the fingerprint. The problem is with the version of the site with a custom domain. On the sitename.vapid.site site, when I’ve linked to the file, it works. On the custom domain version, the link points to a link like this https://cdn.vapid.site/sites/abcd1234-a7c6-42c0-6efd-bdfe6158bfdb/files/file-e903f77fced2cbd78cad9e9259771621.rtf, which when opened would give a 404 error. However, now today it works as expected, after I reverted to the exact same situation which didn’t work previously. So maybe it was a temporary thing with the CDN or deploy process?

Anyway, thank you for the quick reply!

1 Like