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 <noreply@anthropic.com>
This commit is contained in:
para
2026-09-25 23:34:30 +02:00
co-authored by Claude Sonnet 5
parent a46e9c64a2
commit 113616995f
2 changed files with 8 additions and 2 deletions
+6 -1
View File
@@ -54,7 +54,12 @@ function http_get(string $url, array $extraHeaders = []): string
*/ */
function serve_cached_feed(string $cacheKey, callable $builder): void 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)) { if (!is_dir(CACHE_DIR)) {
mkdir(CACHE_DIR, 0775, true); mkdir(CACHE_DIR, 0775, true);
+2 -1
View File
@@ -16,7 +16,8 @@ function fetch_facebook_feed(): string
return http_get(FETCHRSS_URL, ['Accept: application/atom+xml, application/xml']); 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)) { if (!is_dir(CACHE_DIR)) {
mkdir(CACHE_DIR, 0775, true); mkdir(CACHE_DIR, 0775, true);