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
18.104.22.168 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
22.214.171.124/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
126.96.36.199 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;
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.