element-hq / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://element-hq.github.io/synapse
GNU Affero General Public License v3.0
1.6k stars 201 forks source link

Ability to configure User-Agent for URL previews #17873

Open alexgleason opened 3 weeks ago

alexgleason commented 3 weeks ago

Hello. I would like the ability to configure the user-agent used in link preview requests, with an option like: url_preview_user_agent

Why: because currently links to YouTube do not render a link preview on Synapse. This is YouTube's fault. However you can bypass it by pretending to be Facebook, by setting the user-agent to facebookexternalua. Then YouTube link previews will work properly again.

Exposing a configuration will let server admins work around the issue.