From 113616995f1671a4db67fea2d18d531e9081d686 Mon Sep 17 00:00:00 2001 From: para <157126561+mdegallaix@users.noreply.github.com> Date: Fri, 25 Sep 2026 23:34:30 +0200 Subject: [PATCH] Serve feeds as text/xml instead of application/rss+xml Browsers (Firefox in particular) force-download application/rss+xml and application/atom+xml instead of rendering them, which is confusing for site visitors who click a feed link directly rather than pasting it into a reader. text/xml renders inline as an XML tree in every major browser. Feed readers (FreshRSS included) sniff the actual XML content to detect RSS/Atom, so this has no effect on subscription behavior. Co-Authored-By: Claude Sonnet 5 --- php/common.php | 7 ++++++- php/facebook.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/php/common.php b/php/common.php index 273eaf4..b9eb3ac 100644 --- a/php/common.php +++ b/php/common.php @@ -54,7 +54,12 @@ function http_get(string $url, array $extraHeaders = []): string */ function serve_cached_feed(string $cacheKey, callable $builder): void { - header('Content-Type: application/rss+xml; charset=utf-8'); + // text/xml plutot que application/rss+xml : les navigateurs affichent + // ce type en ligne (arbre XML) au lieu de forcer un telechargement, + // ce qui est plus rassurant pour un visiteur qui clique le lien + // directement depuis le site. FreshRSS et les autres lecteurs RSS + // detectent le format en lisant le contenu, pas ce header. + header('Content-Type: text/xml; charset=utf-8'); if (!is_dir(CACHE_DIR)) { mkdir(CACHE_DIR, 0775, true); diff --git a/php/facebook.php b/php/facebook.php index 6c77afe..f594560 100644 --- a/php/facebook.php +++ b/php/facebook.php @@ -16,7 +16,8 @@ function fetch_facebook_feed(): string return http_get(FETCHRSS_URL, ['Accept: application/atom+xml, application/xml']); } -header('Content-Type: application/atom+xml; charset=utf-8'); +// text/xml plutot que application/atom+xml : voir la note dans common.php +header('Content-Type: text/xml; charset=utf-8'); if (!is_dir(CACHE_DIR)) { mkdir(CACHE_DIR, 0775, true);