It’s a strange coincidence, we had to implement CORS on a website yesterday and I found this solution. After installing Caddy 2.1 b1, I can confirm it works great !
When Caddy 2.1 is finalised, it should definitely be a Wiki entry.
Thanks for your help on this.