Delivering and Redirecting RSS Feeds + a Little Experiment

Published in Web Development on Thursday, February 24th, 2005

Watching the hits pile up on the feeds for this weblog, I realized that I should probably do something about the fact that my feed delivery function does not deal with headers, and that I am probably burning up more bandwidth then I need to. What to do? Some answers given and a little help requested below.

It's all about the headers

When I first noticed how many hits were coming through for this sites feeds, I figured that I would simply use a service like Feedburner and any bandwidth issues would be solved. However, after some searching I realized that I should deal with the real problem, and take care of the headers for my feeds.

So this is the solution that I will use. Great.

But can headers do this?

While the above solution will deal with the problem at hand, I did get around to trying out Feedburner and I must say that I like some of the features that they offer.

So I can take care of my bandwidth problem with conditional Gets, and get some nice features by using Feedburner, but what do I do now about my feed URIs?

Dealing with feed URIs

When you burn a feed with Feedburner, they give you a feed address from their server that has your new "Feedburner" feed, and this is what you want to deliver to your subscribers.

Objective

Ideally, you want to redirect the feed URI that you have been using (i.e. the one on your domain) to the new Feedburner feed in a transparent manner. That is, you want http://www.mysite.com/feed to return the feed from http://feeds.feedburner.com/my-feed without anybody having to know about it.

Solution

The answer, apparently, isn't so clear. Thankfully, Feedburner suggests using a 302 response to redirect user-agents to their feed.

Problem - a little help please?

An issue arises, however, when I tried out this solution in a feedreader. Well, in one feedreader really and that's where I need some help from the readers of this weblog.

I set up my .htaccess file to do a 302 redirect of a test-feed URI to the feedburner feed. I then tested what the result was in Bloglines, Feedness (a very nice service) and in Opera 7.54.

The result was fine in the first two services. I subscribed to the local test feed url, and the feedburner feed was downloaded.

Opera also downloaded the feed, however it switched the subscription URI of the feed to the Feedburner URI!!

As you can imagine, this is not good at all. As Opera stores the Feedburner feed address, Opera users will lose my feed should I choose to discontinue using Feedburner in the future.

The request

So what I am asking is that some of you could test out other feedreaders to see if they demonstrate the same behaviour.

Try pointing your reader to the following feed, and let me know if it downloads the feedburner feed (if so, the link at the bottom of an entry in the feed will start with http://feeds.feedburner.com/) and if your reader changes the subscription URI to the Feedburner URI, or if it leaves it intact.

Redirect Test Feed

The implicated URIs

The local test feed URL:
http://www.fiftyfoureleven.com/feeds/rss2/weblog-complete-redirect-test
The Feedburner feed URI:
http://feeds.feedburner.com/FiftyfourelevencomWeblog-FullPosts

Please let me know in the comments if it works as it should and what feedreader you are using. Users of Bloglines and Feedness need not worry about this, as I have already tested them. I'll sum up the results once we have a decent set. Thanks for the help!

Comments and Feedback

In SharpReader, the url shown to links to posts etc are all feedburner, however the url doesn't get updated.

That said, your main old feed, has updated its url to feedburner.

Instead of using a 302 redirect, i'd simply rewrite the url so your server acts as a proxy. Not sure how that will work on your b/w though...

37 Signals moved to feedburner and posted about it too. Whatever they did, you still go via the url on their site. Oh in the blog post http://www.37signals.com/svn/archives/000896.php they mention this in the comments http://www.burningdoor.com/feedburner/archives/000425.html

Hey Dave, thanks. SharpReader noted.

  1. The main old feed, sandbox/weblog/posts.xml, should point locally and not go to feedburner. It does for me...
  2. I looked at the proxy idea, but the bandwith thing, which would be dealt with by using the correct response headers, would be nice to avoid nonetheless (and no mod_proxy for me, though I could readfile()).
  3. I have read the 37signals post on this topic, however Opera has re-written their url as well..
  4. I have also read the other url you provided, and once you get to the meat of it, they recommend using a 302 as well.

I haven't tried this with feedreaders, but you may have more luck with a 303 (see other). That response isn't to be cached, etc, so it may work better.

As a note, Google seems to be happy to do what you're describing with 303s.

Oh... well i noticed that my 37s url hadn't changed, so just assummed what they posted was different...

If you're on windows, then you could use isapi rewrite. Its what i use for all my url rewriteing... thats ofcourse if you justify the cost, and persuade your host to install it... dedicated servers here :)

I wondered about this when I transferred my feed distribution to FeedBurner. In my case a single mod_rewrite rule worked perfectly and totally transparently:

RewriteRule ^feed$ http://feeds.feedburner.com/my-feed

No disruption to subscribers, no need for resubscription... perfect!

Hey Jonathan,

You are mistaken, my friend!! In fact, your feed URL suffers the same fate as mine does in Opera ;-(.

So anyone who has subscribed to your feed with Opera, after you started redirecting to feedburner, has the feedburner URL stored as the location for your feed.

The issue isn't the rewrite, it is what are the feedreaders doing with it when redirected.

Lionfire, the 303 gives the same result in Opera as the 302.

This is a bug in Opera. It should not treat it as a permanent redirect (301). File a bug and get on with it! ;-)

I will Anne, thanks. I'm a little paranoid about other readers beyond Opera.

Looking at all of that hubbub from the voices that should know makes me a little uneasy about things, especially after having the first reader I test in fail.

Oh, and then there is this: I think we can assume that aggregators are HTTP redirect-aware (as I think all of them soon will be).

Assume - nice. I'd rather do my homework, with all of your help of course ;-)

Using FeedDemon, I get a "Failed to connect to http://www.fiftyfoureleven.com/feeds/rss2/weblog-complete-redirect-test" when trying to subscribe to the test feed.

C**p, thanks Jacob can you try again? I must have accidentally uploaded a changed htaccess file...

"your feed URL suffers the same fate as mine does in Opera"

I stand corrected. Bugger! :-(

As an aside, what does this mean Mike: "Tag blockquote may not contain raw character data" - it's preventing me using blockquote in comments so I'd love to know what I'm doing wrong.

Jonathan, it's a bug. You are "supposed" to use something like <blockquote cite="url"><p>your blockquote here</p></blockquote>, but I need to fix something... Maybe I'll do that right now...

NetNewsWire 2.0 gives me the feeds.feedburner.com URI for a post, but the subscription URI points to fiftyfoureleven.

"it's a bug"

Thanks for clarifying that Mike.

Thanks Philippe!

That bug should be sorted now, Jonathan.

Ditto Anne, the 302 redirect is a temporary redirect and the 301 is a permanent redirect. Opera is not adhering to the spec properly by treating a 302 as if it was a 301.

As far as mod_rewrite is concerned, it *is* a 302 redirect. If your mod_rewrite rule URL is pointing to a server other than your own, out goes the 302.

A proxy would not be a viable because it is still using your bandwidth (correct me if I'm wrong).

What's the problem with just using the FeedBurning URL directly for your feed? I know you want to make it transparent for your existing users, but what is so hard about changing a subscription URL? I can do it :)

You could just create a tiny feed on your site that says something to the effect:

"This feed has been moved here: http://37signals.feedburner.com/myfeed.xml"

I don't know, seems fine to me.

Hey Justin, thanks for posting - You may want to update you URL the next time post here (or just go and fix your cookie) as it reads http://www.sacramenentoweb.org/ (I'll fix this one!).

Back to business, asking people to change their subscription url isn't really viable, and if I move away from Feedburner I would have to do it again.

An URI should be permanent, if possible. By using mod_rewrite I have no excuse; the URIs can be taken care of seamlessly. Apart from, it seems, Opera.

Geez, what a dork I am. I noticed that the other day but completely forgot which site I did that on. Thanks for fixing it.

I agree that changing the feed URI is not a good long-term solution, simply for the reason you stated (changing services). If you're not too worried about Opera, then do the redirect and forget about it.

Just so you know, one of the things we're planning on doing at FeedBurner soon is to allow you "gracefully remove" your FeedBurner feed if want to discontinue using FeedBurner. It will allow you to redirect FeedBurner requests to the URL of your choosing.

And yes, Opera's got it wrong. A 302 should be a temp redirect.

Hey Eric, Congratulations!!, and thanks for stopping by ;-).

That "graceful removal" sounds like a good idea.

You speak of Opera as if you know about this issue. Do you? Is it unique to Opera?

Mike, I still get the "Failed to connect" error in FeedDemon. Using IE to request the URI, I am redirected to http://feeds.feedburner.com/FiftyfourelevencomWeblog-FullPosts which in turn gives a "HTTP Status 404 - The feed uri is not found". Did you take the experiment down?

Man, you keep catching me when I screw up!

I have changed that URI, yes. All fixed now.

It's purely unintentional, I guarantee :)

Anyways, subscribed in FeedDemon, got the feed, and it shows the www.fiftyfoureleven.com URL as the Feed s URL.

Cool Jakob, thanks.

Hey Mike, I read your comment. I grabbed the Feedburner URL from the redirect in my browser by mistake. I was getting an error when using: http://www.fiftyfoureleven.com/feeds/rss2/weblog-complete
I will remove my link until I can figure it out what my my error is.

Huh, I see what you are saying, stick the url into the browser and it pops up the 302 url. That's a real shame... This is a losing battle!

It works without a problem when I subscribed in Firefox, so maybe not a total loss.

Yeah, it's definitely not a total loss, many clients deal with it as they should, but there are untold little holes out there and should I ever leave feedburner I'd lose some readers... (gotta keep the few I have!)

Home » Blog » Web Development

Check out the blog categories for older content

The latest from my personal website,
Mike Papageorge.com

SiteUptime Web Site Monitoring Service

Sitepoint's web devlopment books have helped me out on many occasions both for finding a quick solution to a problem but also to level out my knowlegde in weaker areas (JavaScript, I'm looking at you!). I am recommending the following titles from my bookshelf:

The Principles Of Successful Freelancing

I started freelancing by diving in head first and getting on with it. Many years and a lot of experience later I was still able to take away some gems from this book, and there are plenty I wish I had thought of beforehand. If you are new to freelancing and have a lot of questions (or maybe don't know what questions to ask!) do yourself a favor and at least check out the sample chapters.

The Art & Science Of JavaScript

The author line-up for this book says it all. 7 excellent developers show you how to get your JavaScript coding up to speed with 7 chapters of great theory, code and examples. Metaprogramming with JavaScript (chapter 5 from Dan Webb) really helped me iron out some things I was missing about JavaScript. That said each chapter really helped me to develop my JavaScript skills beyond simple Ajax calls and html insertion with libs like JQuery.

The PHP Anthology: 101 Essential Tips, Tricks & Hacks

Like the other books listed here, this provides a great reference for the PHP developer looking to have the right answers from the right people at their fingertips. I tend to pull this off the shelf when I need to delve into new territory and usually find a workable solution to keep development moving. This only needs to happen once and you recoup the price of the book in time saved from having to develop the solution or find the right pattern for getting the job done..