Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS MIME types #989

Closed
richardcornish opened this issue Feb 18, 2012 · 6 comments
Closed

RSS MIME types #989

richardcornish opened this issue Feb 18, 2012 · 6 comments

Comments

@richardcornish
Copy link
Contributor

It seems you're missing setting the MIME type for RSS feeds in .htaccess. I can't find anything in previous issues about this, other than gzipping RSS flavors. I think it's important because when clicking on an RSS link, sometimes the browser tries to automatically download the feed rather than display it, which creates a poor user experience.

# Proper MIME type for all files
AddType application/xml rss
AddType application/xml atom
AddType application/xml xml

I prefer application/xml over application/rss+xml because the former avoids the issue stated above. Additionally, you can put the same MIME type on XML, which also seems to have been overlooked.

@paulirish
Copy link
Member

Do you have any references for the browser behavior mentioned above?

@richardcornish
Copy link
Contributor Author

The EveryBlock source code (specifically the blog app) mentions this in a Python comment when creating the RSS link. Seems like it would be more appropriate to rectify this at the server level rather than a back-end language fix it.

A search shows others encountering the problem. An old post: http://www.petefreitag.com/item/381.cfm. Problems were in Firefox and IE. His solution to use text/xml is deprecated, but my suggestion is current and fixes the aforementioned problems.

I did test on latest Chrome (17.0.963.56), Safari (5.1.3), and Firefox (10.0.2). I don't have Windows or any older versions, so maybe it's just for IE/older browsers. I tested with these URLs:

http://app-xml.richardcornish.com
http://app-rss_xml.richardcornish.com
http://app-atom_xml.richardcornish.com
http://app-rdf_xml.richardcornish.com
http://text-xml.richardcornish.com
http://no_mime_html.richardcornish.com

Chrome was the most inconsistent. Declaring the type or omitting it in the HTML had no effect, sadly. What a waste.

Chrome

  • htaccess, application/xml: Document tree (all)
  • htaccess, application/rss+xml: Raw feed (all)
  • htaccess, application/atom+xml: Raw feed (all)
  • htaccess, application/rdf+xml: Download prompt (all)
  • htaccess, text/xml: Document tree (all)
  • no htaccess:
    • app/xml: Raw feed
    • app/rss+xml: Raw feed
    • app/atom+xml: Raw feed
    • app/rdf+xml: Download
    • text/xml: Document tree

Safari

  • htaccess, application/xml: Safari RSS Reader (Mail.app default) (all)
  • htaccess, application/rss+xml: Safari RSS Reader (Mail.app default) (all)
  • htaccess, application/atom+xml: Safari RSS Reader (Mail.app default) (all)
  • htaccess, application/rdf+xml: Download prompt (all)
  • htaccess, text/xml: Safari RSS Reader (Mail.app default) (all)
  • no htaccess:
    • app/xml: Safari RSS Reader (Mail.app default)
    • app/rss+xml: Safari RSS Reader (Mail.app default)
    • app/atom+xml: Safari RSS Reader (Mail.app default)
    • app/rdf+xml: Download
    • text/xml: Safari RSS Reader (Mail.app default)

Firefox

  • htaccess, application/xml: Preview in Firefox (all)
  • htaccess, application/rss+xml: Preview in Firefox (all)
  • htaccess, application/atom+xml: Preview in Firefox (all)
  • htaccess, application/rdf+xml: Preview in Firefox (all)
  • htaccess, text/xml: Preview in Firefox (all)
  • no htaccess: Preview in Firefox (all)

I do remember the "downloading" issue happening on older versions of Firefox. Still, it's a wide world of upcoming mobile and unpredictable browsers.

@paulirish
Copy link
Member

Awesome detail. :D

Thank you so much for diving deep into this one!

@mikealmond
Copy link
Contributor

How would this effect the compression and expiration headers for rss and atom feeds?

@richardcornish
Copy link
Contributor Author

@mikealmond I'm guessing not at all. Gzip and expiration declarations are in other places in the config. This is just a MIME type. They are all different.

@necolas
Copy link
Member

necolas commented Mar 5, 2012

Fixed by 758eab9 (see #1010)

@necolas necolas closed this as completed Mar 5, 2012
leecade pushed a commit to leecade/server-configs that referenced this issue Nov 6, 2013
alrra added a commit to h5bp/server-configs-apache that referenced this issue Mar 2, 2015
Modify the configurations so that:

 * `.atom` files are served with the `application/atom+xml`¹ media type
 * `.rss` files are served with the `application/rss+xml`² media type

------------------------------------------------------------------------

Until now the configurations ensured that `.atom` and `.rss` files
were served with the `application/xml` media type, and that was done
in order to prevent³ some browsers from opening a download prompt
when users viewed these types of files directly.

That however, in combination with the `X-Content-Type-Options:
"nosniff"` header, prevents⁴ some browsers from doing something other
than just showing the raw content of the files.

By changing the media types we allow browsers to interpret the content
of the files and do more⁴ then just display them in raw form (e.g.:
show a nicer preview of the file, open the file in a local application),
and thus, we improve the user experience.

Note: One issue with this change is that IE 6 users will get the
download prompt, but that isn't a big problem nowadays.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

¹ https://www.iana.org/assignments/media-types/application/atom+xml
² http://tools.ietf.org/id/draft-nottingham-rss-media-type-00.txt
³ h5bp/html5-boilerplate#989#50 (comment)

------------------------------------------------------------------------

Thanks Gennadiy Litvinyuk (@gennadiylitvinyuk)!

Ref #50
Close #50
eleanor-byhook pushed a commit to eleanor-byhook/html5-boilerplate that referenced this issue Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants