Server.js icon indicating copy to clipboard operation
Server.js copied to clipboard

Expires header

Open cKlee opened this issue 9 years ago • 3 comments

Is there a way to configure the Expires header for the results? I edited Controller.js to add the header:

response.setHeader('Expires', new Date(+new Date() + 86400000).toUTCString());

but this would be nice to set in the config.json.

The Expires header is needed for Apache mod_cache.

cKlee avatar Apr 27 '16 09:04 cKlee

Hi @cKlee, it might be possible to make an option for this.

For this concrete case, however, I wonder if it is necessary for mod_cache. I'm an an NGINX user myself, but I just do:

proxy_cache_valid 200 302 404 60m;

where the 60m determines expiry. It would seem plausible that Apache would also offer this.

RubenVerborgh avatar Apr 27 '16 09:04 RubenVerborgh

@RubenVerborgh Apache indeed also has a very similar option, yet the most logical approach to me seems that the NGINX or Apache proxy take into account the headers coming from a nodejs app. Imagine datasets where some triples are changing more often than others: we need to be able to handle the max-age and expires within our nodejs itself instead of, by default, adding a 1 hour cache through configuration of a cache that doesn't take into account the context of the response.

pietercolpaert avatar Apr 27 '16 11:04 pietercolpaert

@pietercolpaert Of course, I agree on the existence of more complex cases. It's just, like I said, "for this concrete case", where it seems to be a constant, that complexity is not necessary.

RubenVerborgh avatar Apr 27 '16 11:04 RubenVerborgh