Hi, thanks for your image.
I've tried to use the custom headers feature. They work for files, but not for directories, although requesting a directory leads to its index.html. To be more precise, a config entry with "path": "*", "fileExtension": "html" does apply when requesting /path/index.html, but does not for /path, although the response body is the same.
The code at
|
reqFileExtension := filepath.Ext(r.URL.Path) |
shows that the middleware applies to the URL. Would it be possible to apply to the resolved file instead?
As a side note, I believe path + fileExtension should be superseded by a path glob or a regex, which is more powerful, and is actually not more complex. For instance, a rule with glob /**/ or regex \/$ would apply to any directory, and a rule with glob /**/*.css (or maybe even *.css) or regex \.css$ would apply to any CSS file.
Hi, thanks for your image.
I've tried to use the custom headers feature. They work for files, but not for directories, although requesting a directory leads to its
index.html. To be more precise, a config entry with"path": "*", "fileExtension": "html"does apply when requesting/path/index.html, but does not for/path, although the response body is the same.The code at
goStatic/customHeaders.go
Line 88 in 131f492
As a side note, I believe path + fileExtension should be superseded by a path glob or a regex, which is more powerful, and is actually not more complex. For instance, a rule with glob
/**/or regex\/$would apply to any directory, and a rule with glob/**/*.css(or maybe even*.css) or regex\.css$would apply to any CSS file.