Is it possible to push all the images or script in a given folder?
I don’t really need it now, I can list the resources since they are not so many.
What would be convenient is to have Caddy pick up new assets so I don’t have to reconfigure the Caddyfile
just because I added a couple of images or scripts that are rendered everywhere.
That isn’t the intended use for HTTP/2 Server Push. It more for optimising the critical render path for best perceived page loading times i.e. critical css, js files which are needed to render the page above fold. Pushing all images within a directory isn’t one of those ideal use cases and probably do the opposite in increasing the perceived page load times and HTTP/2 generally negate that requirement anyway.
It’s more about letting the app developer not having to micro manage every server push config.
It’s not a matter of pushing loads of images but allowing the developers to change which images are pushed simply by replacing, adding or deleting images in certain folders.
I understand your intentions though for images pushing them isn’t really needed or optimal. CSS and JS files yes but not images. Think how it would go down on a client’s slow 3G mobile connection and many images being pushed.
Yes, pushing a lot of assets all the time is not good but I still think at least the directory specification would be nice. You could then specify 2 separate directories /css and /js to load stuff that are genuinely push friendly and manually specifying image resources that are common for example logos etc.
The harmful performance effects of pushing lots of files is amplified by the fact that server push doesn’t really have a good way to consider the client’s existing cache…