ATOM MIME Type – Free, Online, Private
application/atom+xml is the RFC 4287 type for an Atom feed. RSS is a different vocabulary and is not this type.
What .atom is
Atom is an XML format for a feed of entries. The root element is feed in the Atom namespace, and each entry has an id, a title, and an updated timestamp. RFC 4287 registers application/atom+xml. A single entry can also be served as this type when it is an Atom entry document rather than a feed. The body is XML. Send charset=utf-8. RSS 2.0 is a different vocabulary. The conventional type for RSS is application/rss+xml, which is not what IANA lists for Atom, and it is not a synonym. A browser that does not have a feed UI will show the XML tree. That is fine. The type is still application/atom+xml.
IANA registers application/atom+xml in RFC 4287. The media type is application/atom+xml. Extensions that use it on this page: .atom. A client compares the type, not the filename, once the response has arrived. The filename still matters on disk and in Content-Disposition, which is why a wrong extension and a wrong header are two different bugs.
What sends application/atom+xml
What sends application/atom+xml: Send application/atom+xml; charset=utf-8 for the feed URL. Link it from HTML with rel=alternate and type=application/atom+xml so a client can find it. The HTML page stays text/html. Do not serve the feed as text/html or the client will try to parse a document as a feed and fail. Cache a feed briefly. A long cache on a feed URL hides new entries. If the feed is paginated, each page is the same type. Say the relation with rel=next and rel=prev links inside the document, not with a different media type. The file on disk is still .atom. Once the response exists, a client trusts application/atom+xml, not the filename. If you publish both Atom and JSON Feed, JSON Feed is application/feed+json on its own URL. Do not label a JSON body as application/atom+xml. Negotiation on one URL requires Vary: Accept. Two URLs are simpler and match how rel=alternate already works.
Content-Type for .atom
Send application/atom+xml; charset=utf-8. The charset parameter names the encoding of the body. Leaving it off forces the client to guess, and for several text types the registered default is not UTF-8. Do not send a charset on a redirect. The header belongs on the response that contains the bytes.
Content-TypeContent-Type: application/atom+xml; charset=utf-8
nginx, Apache, and Express
These snippets map .atom to application/atom+xml. nginx reads the types block when it picks a type from the URL's extension. A location that sets default_type, or an application that sets the header itself, overrides that map. Apache AddType applies in the directory context where you put it. The Express static example writes the header for files ending in .atom so a stale mime database in the framework cannot disagree with the type on this page.
nginx# /etc/nginx/mime.types, inside the types { } block
application/atom+xml atom;
charset utf-8;
charset_types application/atom+xml;
ApacheAddType application/atom+xml .atom
AddCharset UTF-8 .atom
Expressimport express from "express";
const app = express();
app.use(express.static("public", {
setHeaders(res, filePath) {
if (filePath.endsWith(".atom")) {
res.setHeader("Content-Type", "application/atom+xml; charset=utf-8");
}
},
}));
Pitfalls for application/atom+xml
Pitfalls that show up for application/atom+xml, and not for a neighboring type with a similar extension: The id element has to be an IRI and it has to stay stable when the title changes. Clients use it to de-duplicate. The type will not generate it. Another trap is timestamps without a timezone. Atom wants a date-time with an offset. Another is an HTML summary that is not well-formed XML because you pasted a bare ampersand or an unclosed tag into an XHTML div. The feed then fails to parse at all, not just that entry. Another is serving the feed through an HTML-escaping middleware that turns the markup into text the client displays literally.
- application/atom+xml is Atom. application/rss+xml is the conventional RSS type and is a different document.
- application/xml is a weaker fallback. Feed readers look for the Atom type.
- The feed and the HTML page are two responses. Do not send the feed type on the homepage.
- A BOM before the XML declaration can break a strict parser. Start with < or with the declaration.
Frequently asked questions
What type is an Atom feed?
application/atom+xml, from RFC 4287.
Is RSS the same type?
No. Atom and RSS are different XML vocabularies. RSS conventionally uses application/rss+xml.
Should I send a charset?
Yes. application/atom+xml; charset=utf-8.
How does a browser find the feed?
From a link rel=alternate with type=application/atom+xml in the HTML page, not from the page's own Content-Type.