What is the correct MIME type to use for an RSS feed?

RssMime Types

Rss Problem Overview


Is one MIME type preferable to ensure compatibility with RSS readers and other scrapers?

The options seem to be:

  • text/xml
  • text/rss+xml

Interestingly Stackoverflow is using text/html.

Rss Solutions


Solution 1 - Rss

Solution 2 - Rss

Other commenters have pointed out that the single correct mime type is application/rss+xml,.

However, if you are setting an accept header for a client then

Accept: application/rss+xml, application/rdf+xml;q=0.8, application/atom+xml;q=0.6, application/xml;q=0.4, text/xml;q=0.4

might be a good choice, as it states that it accepts RSS, Atom, and XML (in descending order or preference).

Solution 3 - Rss

Here's a pragmatic answer: whatever the "correct" answer may be (and clearly there is debate about this), text/xml is the type used by pretty much all the popular feeds out there in the wild.

Here are a few that I checked:

$ for f in \
  https://feeds.feedburner.com/TechCrunch/ \
  http://feeds.bbci.co.uk/news/video_and_audio/news_front_page/rss.xml \
  http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml \
  https://daringfireball.net/thetalkshow/rss \
  http://www.npr.org/rss/podcast.php?id=381444908 \
  http://feeds.serialpodcast.org/serialpodcast \
  http://podcasts.joerogan.net/feed \
  https://feeds.feedburner.com/thetimferrissshow \
  http://feed.thisamericanlife.org/talpodcast ; do \
  curl -s -I $f | fgrep -i Content-Type: ; done
content-type:text/xml; charset=UTF-8
Content-Type: text/xml
Content-Type: text/xml
Content-Type: text/xml;charset=UTF-8
Content-Type: text/xml;charset=UTF-8
Content-Type: text/xml; charset=UTF-8
Content-Type: text/xml; charset=UTF-8
content-type:text/xml; charset=UTF-8
Content-Type: text/xml; charset=UTF-8

So you can be sure that text/xml will be correctly interpreted by commonly used RSS clients.

Solution 4 - Rss

The most correct is application/rss+xml

The most compatible is application/xml

According to W3C: > RSS feeds should be served as application/rss+xml (RSS 1.0 is an RDF > format, so it may be served as application/rdf+xml instead). Atom > feeds should use application/atom+xml. Alternatively, for > compatibility with widely-deployed web browsers, any of these feeds > can use one of the more general XML types - preferably > application/xml.

https://validator.w3.org/feed/docs/warning/UnexpectedContentType.html

Solution 5 - Rss

Go for MIME application/rss+xml to be safe if you want to make sure your feed is compatible with RSS readers and other scrapers. That's what I use.

Solution 6 - Rss

You could use text/xml, but the correct MIME type would be application/rss+xml.

Solution 7 - Rss

text/xml is the only correct answer. Mime types are a registration based system. There is an official list managed by IANA (Internet Assigned Numbers Authority) at http://www.iana.org/assignments/media-types/media-types.xhtml

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSteve ClaridgeView Question on Stackoverflow
Solution 1 - RssvartecView Answer on Stackoverflow
Solution 2 - RssRobert MacLeanView Answer on Stackoverflow
Solution 3 - RssKai CarverView Answer on Stackoverflow
Solution 4 - RssnggitView Answer on Stackoverflow
Solution 5 - RssadyoungsfanView Answer on Stackoverflow
Solution 6 - RssCerebrusView Answer on Stackoverflow
Solution 7 - RssMonkey CodeView Answer on Stackoverflow