http-server
http-server copied to clipboard
Feature: Do not cache local, but cache remote files (option)
Currently, when the cache time is passed via the -c
option, it is applies to both local files and files transferred via the --proxy
option. However, disabling caching by using -c-1
or -c 0
for remote addresses can make page loads quite slow.
So ideally the --proxy
option would also take an optional timeout argument.
Could you provide more context/description? What would you like to see in this option, and where exactly would caching happen and not happen? What do you mean by local and remote files?
Can't talk about remote files, but as far as local files are concerned, the server still caches the loaded CSS stylesheet and doesn't update on refresh, even with the -c-1
flag.
By local do you mean files on the server or client?
Sorry, don't understand how you mean that. By local I meant the files that are locally on my disk in the root directory, so for example it would be the css/index.css
file for the stylesheets.
The clarification is because those files are only local to http-server, not to the browser (the client). That doesn't sound quite right though because the server doesn't do any caching at all, are you sure it's not being cached in the browser?
With -c-1
, the server can only tell the browser not to cache, it can't actually make it happen, which means sometimes the browser caches anyway.
Oh, yeah sorry, you're right. Manually force reloading with the cache updates the site, so it must be the browser caching it.
I think I meant: local files are the ones local to the http-server, remote files are the ones accessed via the --proxy
option.
So ideally the --proxy
option would also take an optional timeout or so?
Sorry for such late clarification.
Oh, yeah sorry, you're right. Manually force reloading with the cache updates the site, so it must be the browser caching it.
https://github.com/http-party/http-server/issues/412 https://stackoverflow.com/questions/47470325/what-is-the-difference-between-max-age-0-and-max-age-1-in-cache-control
This issue has been inactive for 180 days