-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow different cache times for different urls #63
Comments
+1 on this. Multiple
? |
I would be ok PRing to this if a PR is welcome. |
I'm not sure this is possible in the scope of First of all, "http-server is a simple […] command-line http server". I think it's sad that JS projects on GitHub trying to keep things simple (and leave advanced use cases to others) are constantly made more complex. But that's just MHO. Second, |
@derhuerst the issue on ecstatic is right here in this thread, with a merged PR to add support to custom caching.
It still seems reasonable to me that a static assets server has advanced support for caching. Adding this has not impact on who's not gonna have a use for multiple caching values. Also, what do you think is going to happen if this doesn't land? People are going to use |
Sorry, didn't see this.
I've been following the After a while, more and more tiny features get added, which all support a completely valid and reasonable use case. The software gets bigger and bigger, harder to maintain, etc. In the end, the tool will end up like This is all not really a problem, for a lot of feature requests however, it just seems like To move on from general panicking, I see two specific features being requested quite often. A web server with CLI-pluggable modules is needed. Something like express, ecstatic or koa, but configurable from the command line. Different features could be used more easily than setting up a JS file, just by passing flags. One would get the benefits of the CLI (aliasing, autocompletion, familiar syntax) "for free". Requested features that go in this direction: #35, #63, #83, #110, #139, #201, #67. Second, a comfortable way to serve single page applications. This might become a possible duplicate of spa-server, spaserve and devserve. Issues regarding this: #69 and #95, #7, #80, #254. Please keep in mind this is just my opinion and I'm not sure in what direction @indexzero wants to go with this project. |
@derhuerst thanks for taking the time to write back. I disagree. A Everything you said seems unrelated. Let's see what happens and leaver the politics out of it. |
That is my personal opinion as well, just like I believe in small CLI projects (like what
I agree to this as it is phrased right now. But I also think that a detailed cache control should not be part of a small-scope module like this.
It seems unrelated as it is a lot more general, because I tried to sum up what my impression of the feature requests of |
Created a pull request for this #404 |
So, I am inclined to agree with @derhuerst and say this is not really in scope of |
a cache argument. Added logic to support inline and imported cache functions. Fixes (http-party#63)
After mulling this over for... oh my, a year and a half... I'm not so sure this should be added. I had agreed on passing the functionality through, but since that comment, ecstatic has been deprecated and we're set to to remove the dependency in #693, and we'll be removing excess functionality in #697. |
Currently http-server allows you to configure the "cache-control: max-age" value for all urls. But often you want a short max-age for e.g. /{index.html} and a long max-age for urls to versioned assets like /styles/f35ac111.main.css.
Would you accept a patch to allow specifying different max-ages for different urls? (This could be implemented most generally by matching the request url against one or more configurable regexes which map to corresponding max-ages, for instance. But if it's simpler, just giving the long cache time to everything that isn't in the root directory, or every asset with a name like a1b2c3d4.filename.ext would probably work for many use cases.)
The text was updated successfully, but these errors were encountered: