Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I'm currently trying to set up a reverse proxy redirecting a domain to a tumblr blog. I've set up NGinx using this Gist. My nginx configuration looks like so:

upstream tumblr {
        server 66.6.44.4;
}

server {
        listen          80;
        server_name     mydomain.com;

        access_log      /var/log/nginx/mydomain.access.log;

        proxy_set_header  X-Real-IP       $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  Host            $http_host;
        proxy_set_header  REMOTE-HOST     $remote_addr;
        proxy_redirect    off;
        proxy_max_temp_file_size          0;

        location / {
                proxy_pass http://tumblr;
                break;
        }
}

server {
        listen          80;
        server_name    www.mydomain.com;
        rewrite ^/(.*)  http://mydomain.com/$1 permanent;
}

Unfortunately, this doesn't work. When I attempt to connect to my blog via mydomain.com, I get the "there's nothing here" page on Tumblr. How can I properly make my reverse proxy work with Tumblr?

Things I've tried:

  • I cannot add mydomain.com as a custom domain because the A record points to the IP I have Nginx on and not the required Tumblr domain (66.6.44.4).
  • Changing the upstream server to myblog.tumblr.com does absolutely nothing.
share|improve this question

migrated from webapps.stackexchange.com Dec 2 '13 at 11:14

This question came from our site for power users of web applications.

    
It must be destiny! I'm totally a lurker on webapps, and this question was the second newest question on webapps! :) I hope you enjoy my solution! –  cnst Dec 1 '13 at 8:20

1 Answer 1

up vote 5 down vote accepted

Great question! This can actually be done, but it's relatively tricky.

Tumblr has made it very clear that they don't want you to do this. They have silently broken CloudFlare integration a while back, where everyone who did this reverse proxy stuff with CloudFlare has basically gotten booted off of their custom domain name without any warning. (Keep in mind that many people were using CloudFlare in the first place, because Tumblr was often giving out blank pages, or refusing connections, so, CloudFlare integration was actually beneficial for reliability and user satisfaction.)

As an early Custom Domain adopter myself, preceding their 66.6.44.4 allocation and rollout, I've had this booting-off happen to me, too, earlier this summer 2013, where they've disabled my custom domain name (still pointed directly to their own servers as per their own instructions) with a very short and inadequate notice. I still haven't recovered my Google Index. I've decided that I won't be tricked like that anymore.

Custom domain name route

If you still want to do this, you'd have to run your own DNS server, in a DNS split-horizon mode, to provide different DNS replies to tumblr.com and non-tumblr.com networks. Doing a split horizon on 66.6.32.0/20 works so far, but, of course, there's no guarantee it'll continue working (however, this part is probably the least likely one to break).

Further, probably do as what you're already doing.

I did this, and it works, although it does feel somewhat fragile, but there's no better way to do it.

Note that if you simply try to publish several A records at once, or try to publish the 66.6.44.4 only temporarily to have a custom domain name accepted in their interface, then it'll end up broken just as you describe, within a day or two afterwards, because tumblr keeps re-checking the records, and automatically disables the custom domain name feature, if it doesn't see the stuff it wants to see.

If you do caching, there are also other issues to consider (which would probably be a separate question, too).

Page hijacking route

To go the content hi-jacking mode, simply change:

proxy_set_header    Host    $http_host;

to something like:

proxy_set_header    Host    domain.tumblr.com;
proxy_redirect      default;

Do not enable the custom domain name option in the interface.

This way, you'll simply be creating a mirror of your tumblr.

I highly don't recommend this, because it's quite pointless, as any likes, favs and reblog backlinks you'd have on tumblr.com will point to your tumblr.com name (unless you find a way to trick the search engines), so, you are not very likely to gain any search positions for your mirror, unless doing some further tricks, or willing to take the chances. It'll also be confusing for your visitors, and for yourself, too.

Avoiding tumblr route

There are many alternatives to tumblr. I'm currently investigating switching to one of the Python or Ruby -based static blog generators like those based on Jekyll that work based on templates and generate static HTML. You could still enable disqus comments, and some claim to have certain tumblr integration for migration away from tumblr.

A whole other question, though. But if you do plan to migrate this way, it'll be useful to still use the split-horizon DNS and a custom domain in tumblr, such that all your backlinks would still point to your site. It's probably even possible to import your posts into tumblr, automatically export them to get their assigned URLs, and map those assigned URLs on your site to the actual entries in your then-native Python or Ruby blog, getting the backlinks from tumblr, without a requirement of having to use tumblr itself.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.