Need Some mod_rewrite/mod_proxy Voodoo Experts

OK lazyweb – I need some advice.

I want to configure Tailrank so that when an RSS aggregator fetches http://rss.tech.tailank.com it is actually internally proxied to http://feeds.feedburner.com/TailrankTopStories.

I thought the following mod_rewrite rule would work:


RewriteCond %{SERVER_NAME} ^rss.tech.tailrank.com$
RewriteCond %{HTTP_USER_AGENT} !^FeedBurner.*
RewriteRule ^/$ http://feeds.feedburner.com/TailrankTopStories [P]

This basically says: “if anyone but FeedBurner fetches rss.tech.tailrank.com make them internally use a proxy server as a reverse proxy to fetch the content.”

I was thinking that this way all my existing clients would just transparently start using the new Feedburner URL and I’d still get to control my URL space.

The only problem is that it doesn’t work.

What it does is use feeds.feedburner.com as an HTTP proxy and then execs

GET http://rss.tech.tailrank.com HTTP/1.0

which isn’t what I wanted. That URL of course will 404…

Is there any way to do this or is it just impossible?


  1. For what it’s worth, the rules you list /should/ work. Perhaps, however, you don’t have mod_proxy installed and working properly?

    Look at “Dynamic Mirror” at http://httpd.apache.org/docs/1.3/misc/rewriteguide.html for proof that your method is sane.

  2. yeah…. I figured I wasn’t going insane.

    Anyway… the problem I think is that the GET URL isn’t updated … either that or the Hostname remains the same. I’m goign to look into figuring out how to change the hostname…..

  3. I did the same thing for unto.net. However, I used named virtual hosts, rather than the condition for SERVER_NAME.

    You may want to try this:

    <VirtualHost *:80>
    ServerName rss.tech.tailrank.com

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} FeedBurner [OR]
    RewriteCond %{HTTP_USER_AGENT} FeedValidator [OR]
    RewriteCond %{QUERY_STRING} redirect=no
    RewriteRule .* {the real feed URL} [QSA]
    RewriteCond %{HTTP_USER_AGENT} !FeedBurner
    RewriteRule .* http://feeds.feedburner.com/TailrankTopStories [R=permanent,L]
    </IfModule>
    </VirtualHost>

    I included a rule for FeedValidator as well so you can check your feed. Or test it by hand by adding “?redirect=no” to the URL.

    I’m not 100% sure about the syntax, as I didn’t test it with apache, but it is close to what I use myself.

    Good luck! Please post your solution when you figure it out.

  4. OK…. so I sort of have it working now…..

    But the UI isn’t exactly pretty:

    http://feedburner.tailrank.com/TailrankTopStories

    That’s a proxied URL… its a valid RSS feed but the XSLT stylesheet isn’t working.

  5. Ah……. I think whats happening is that they’re checking the URL and if its not a feedburner URL then they’re punting on the UI…… hm.

  6. I’m sorry, I totally misunderstood where you were going with that.

    Now here’s a question, if you proxy to Feedburner, will all of the subscriber statistics still track correctly?

  7. OK….. I *sort* of have it working…….. how the URL looks like:

    http://feedburner.tailrank.com/TailrankTechnology

    Which is totally broken. It must be some bug in their Javascript which I don’t want to have to debug right now.

    Hm…..

  8. Some more thoughts.

    I don’t think this is possible in our config. The problem is that we use a load balancing proxy but we have to specify an explicit Hostname based on the calling URL. We can’t do both in this situation because feedburner requires feeds.feedburner.com. They’d have to configure feeds.feedburner.com to accept any hostname.

    The other issue is that they’d need to serve their XSLT stylesheets form the same domain that I’m serving the feed from. Apparently there’s an issue here with browsers not rendering XSLT stylesheets across domains… (at least on Firefox).

    Note that theres a setting in the Browser Friendly section for the original feed URL and they could use this to fix the above issues.

    Kevin

  9. Why don’t you just do a redirect?






%d bloggers like this: