On a XPage, when I want to display an image which is stored as a file attachment of a NotesDocument, I define the image source as follows: [UNID_OF_FILE]/$FILE/[NAME_OF_ATTACHMENT].
Whenever a page contains this kind of source, a HTTP request is performed. Since there is no "Expires" date defined in the response headers, the HTTP status is (in best case) "304 Not Modified", which means that the attachment is not again loaded from the server. However, this is still a HTTP request that increases the page's loading time. Is there a way to set the expiration date for these responses to get a HTTP status "200 OK (Cache)" which does not perform a HTTP request and directly loads the image ressource from the cache?
PS: I know I could create a "helper" XPage (for downloading this file attachment) which manually sets the response headers with facesContext.getExternalContext().getResponse().setHeader(...) etc. Yet this would mean that I would have to largely rewrite my XPages application. I hope that there are some server or database settings that allow to directly set the corresponding response headers.
You can add a Web Site Rule that sets the Expires header (and other HTTP headers).
Here's an example of a web site rule that sets the Expires header to 14 days for all files of type jpg: