Hello all. I am new to using caddy and so far I am very impressed. I have run into a road block though which is preventing me from using the server as I would like. The issue is when I request a .js file and there is a min.js file equivalent it returns the contents of the min.js file. I have disabled the minification and then see the original file but when I enable the minification once again I see the min file. Is there a way to disable this when using the browse directive:
I think this is related to the gzip directive. It states that if a file has a gz version then it will automatically use that file. I am trying to us the not option to block the path but it doesn’t seem to work.
I’m not understanding what’s going on My plugin doesn’t do any of that (but that would be a great idea: if sth.min.js was present, it would be served instead of minifying on the fly).
Sorry for a late response. As I looked further into the functionality of the automation that caddy performs I learned more that the if you have a file such as .js and then also .js.gz the gz file contents will be automatically rendered in place of the js file. As noted in the documentation:
Note that, even without the gzip directive, Caddy will serve .gz (gzip) or .br (brotli) compressed files if they already exist on disk and the client supports that encoding.
I later found a way around this functionality. Thank you everyone for your responses.
My min.js files have a .gz version. During my build process I generate the min.js file then gz it. Since the file exists caddy automatically renders the file. I noticed it was doing this process automatically after the fact.