element-hq / element-hq/synapse

URL preview should use `Accept-Language: en-US, en` by default

Open
#11,604 0 comments 0 reactions 0 assignees View on GitHub
P3 T-Task
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#11604](https://github.com/matrix-org/synapse/issues/11604).

---

### Description

This is about the `url_preview_accept_language` setting, which seems to have a default value of `['en']`.

This may be site-specific, but.. as an example, I find that doing `curl -H 'Accept-Language: en' 'https://www.imdb.com/title/tt13207508/' | grep Schwanengesang` yields a result for me ("Schwanengesang" being the German title of the "Swan Song" movie) when done from a German IP address.

A way to get it to stop IMDB from feeding me German content (when accessing it from a German IP address) is to use a different `Accept-Language` value. Both `en-US` and `en-US, en` seem to work well.

Given that browsers (Firefox, Chromium) seem to pass both `{languageCode}-{countryCode}` and `{languageCode}` at the same time, it's probably more reliable if Synapse does the same (sending `Accept-Language: en-US, en`).

### Version information

- **Version**: v1.49.0 seems affected by default

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.