Content Negotiation Plugin

After quite some tinkering and brooding, I think I have a workable Content Negotiation matcher plugin for Caddy. It covers content type, language, charset and encoding negotiations. (Sorry if I have overlooked some plugin that already does some of it.)

Please have a look, this is my first plugin (and only my secondish project in Go), so any and all feedback is very welcome!!

(I hope I have prepared the repository correctly so that you can get and run it easily. If not, I would be thankful for any pointers.)

I am looking forward to hearing if you think this is useful.
Best wishes,

Andreas

3 Likes

Ooo, goodie, I have been wondering when one of these would pop up! (I kept thinking I was going to do it myself but never got around to it, nor was the demand really there.)

Looks like this could be really helpful for sites with translations, like doesmysiteneedhttps.com (which currently uses a very naive header matcher to check for the presence of a language, regardless of order or preference, heh).

Thanks for sharing! I’ll spread this around.

PS. When you get a chance, please add it to our download page by creating an account and claiming your plugin there. Then others will be able to easily install it too!

When you get a chance, please add it to our download page by creating an account and claiming your plugin there.

Okay, I think I successfully just did so.

One of the most important things to take care of is the testing. I am shying away a bit from reimplementing everything that xcaddy did for me up to now, but I’ll eventually get round to it. At the moment, I merely copied the testing file over from the cors plugin. (So testing fails at the moment.)

Also, before that, I’d like to be more confident that the API (Caddyfile options) and usage scenarios that I’ve been thinking of are sensible and don’t miss something important.

1 Like