Improve content negotiation handling for forwarding AS2 requests #2463
Description
Hi all! First off, thank you for building and maintaining Elk. It's great!
A few of us noticed recently in #2457 that Elk's Accept
header parsing for content negotiation is pretty brittle and limited. It looks like it only forwards requests to the underlying Mastodon instance if the Accept
header is exactly application/ld+json; profile="https://www.w3.org/ns/activitystreams"
. If it's at all different, eg even just removing the space to get application/ld+json;profile="https://www.w3.org/ns/activitystreams"
, Elk serves HTML instead of forwarding.
(My service uses a more involved Accept: application/activity+json; q=0.9, application/ld+json; profile="https://www.w3.org/ns/activitystreams"; q=0.8, text/html; charset=utf-8; q=0.7
, which Elk also doesn't handle.)
Thanks in advance for looking at this!
(Btw, on a related note, lower priority, any chance you could configure https://elk.zone/ to forward AS2 conneg requests too? Right now it doesn't, even with the exact Accept
header above.)