Closed victor-sudakov closed 2 years ago
Hey @victor-sudakov . Thanks for the proposal. We will discuss your FR. Generally, the proposed changes seem to be a good enhancement to the existing static
plugin. So, the static
configuration section might look like the following:
static:
dir: "../../../tests"
forbid: [""]
allow: [".txt", ".php"]
calculate_etag: true
weak: true
request:
"input": "custom-header"
response:
"output": "output-header"
dir2: "../../../tests2"
forbid: [""]
allow: [".txt", ".php"]
calculate_etag: true
weak: true
request:
"input": "custom-header2"
response:
"output": "output-header2"
So you would have better control over the particular static files. The main problem here is to not introduce a BC in the configuration.
I'd suggest using a list to be more consistent with modern fashion:
http:
static:
- path: "/www/images/"
response:
Cache-Control: "public, max-age=300"
- path: "/www/js/"
response:
Cache-Control: "no-cache"
I'd suggest using a list to be more consistent with modern fashion:
http: static: - path: "/www/images/" response: Cache-Control: "public, max-age=300" - path: "/www/js/" response: Cache-Control: "no-cache"
yeah, sure, I meant the same (to use list). So, will see, I expect to be done in 2.5.x
, after we release 2.5.0
(probably next week).
I did not quite understand the idea. Does this new static files server listen on a port different from http.address? It was great that RR could serve both static and dynamic content on the same port (it worked much like try_files in nginx), but now is that impossible?
Discussion in the PR: https://github.com/spiral/roadrunner-plugins/pull/130
I think the new fileserver plugin is great, thank you very much! It could benefit from a couple of more features but this would be another feature request if ever.
@victor-sudakov You are welcome)
Is your feature request related to a problem? Please describe. If I want to serve static files with different response headers, e.g. some files should have "Cache-Control: "public, max-age=300" and others "Cache-Control: no-cache" there seems no way to do it.
Describe the solution you'd like Could we have more than 1 static.dir with distinct "response" settings?
Describe alternatives you've considered The only alternative is putting nginx in front of roadrunner which I don't particularly like.
Additional context It would be also nice to be able to set the Expires header on static files, but it's probably another feature request already.