V2: Try file server first?

That makes sense, thanks for the info. I think it would be awesome if the caddy fileserver would take priority for requests that match files in the root, and then hand off to the reverse proxy for those that don’t.

Here’s the matcher that I came up with for avoiding static assets with a webpacker rails app in case anyone else needs it

matcher notStatic {
    not {
        path /assets/* /packs/js/* /404.html /422.html /500.html /robots.txt
    }
}

This works, but I was confused why all of the paths have to be on the same line. For example the following will not work.

matcher notStatic {
    not {
        path /assets/* 
        path /packs/js/* 
        path /404.html
        path /422.html
        path /500.html
        path /robots.txt
    }
}

But according to the docs matchers in the same group are anded so it should work the same, no?

1 Like