I thought that it would be possible to add custom header values in another handler running before the StaticHandler. But this does not seem to work.
Why does the StaticHandler get rid of all values in the Cache-Control header before adding values itself. Wouldn't it be possible to concatenate them?
The code does not check if the header is already set and just replaces, the fix is trivial, if current value not null or empty, replace, else concatenate.
This could be a good first contribution 馃槈
I can give a try!
As we've been talking in the PR #960, for the "cache-control" is not enough comparing if it exists a previous value for the header, we need to check the following things:
What do you think? @leolux @pmlopes
If a user explicitly defined the cache headers before the static handler I don't think it's the static handler task to perform these validations.
Or are you speaking about something else?
It's not about validation. @leolux said in the PR that the value isn't added to the header if the header previously exists, not if the value previously exists in the header. I think that the scenario he proposed is that if we add "min-fresh" to "cache-control", we still want that the StaticHandler adds "public" and "max-age" to "cache-control". So, we have to check the previous value of the header, not if the header exists. It's a little more tricky and I don't know if it would be useful.
In my previous comment, I mean we check that the header previous value doesn't contain one of the indicated (must-revalidate, no-cache,...) and only if it doesn't contain any, we append the value to the header.
Most helpful comment
I can give a try!