This is an automated archive made by the Lemmit Bot.
The original was posted on /r/selfhosted by /u/PixelHir on 2025-02-11 00:08:03+00:00.
I'm writing this guide/testimony because I deleted my twitter account back in November, sadly though some content is still only available through it and often requires an account to properly browse it. There is an alternative though called Nitter that proxies the requests and displays tweets in proper, clean and non bloated form. This however would require me to replace the domain in the URL each time I opened a Twitter link. So I made a little workaround for my infra and devices to redirect all twitter dot com or x dot com links to a Nitter instance and would like to share my experience, idea and guide here.
This assumes few things:
- You have your own DNS server. I use Adguard Home for all my devices (default dns over Tailscale + custom profiles for iOS/Mac that enforce DNS over HTTPS and work outside of Tailnet). As long as it can rewrite DNS records it's fine.
- You have your own trusted CA or ability to make and trust a self signed certificate as we need to sign a HTTPS certificate for twitter domains without owning them. Again, in my case I just have step-ca for that with certificates trusted on my devices (device profiles on apple, manual install on windows) but anything should do.
- You have a web server. Any can do however I will show in my case how I achieved this with traefik.
- This will break twitter mobile app obviously and anything relying on its main domains. You won't really be able to access normal Twitter so account management and such is out of the question without switching the DNS rewrite off.
- I know you can achieve similar effect with browser extensions/apps - my point was network-wide redirection every time everywhere without the need for extras.
With that out of the way I'll describe my steps
- Generate your own HTTPS certificate for domains x dot com and twitter dot com or setup your web server software to use ACME endpoint of your CA. Latter is obviously preferable as it will let your web server auto renew the certificate.
- Choose your instance! There's a bit of Nitter instances available from which you can choose here. You can also host it yourself if you wish although that's a bit more complicated. For most of the time I used xcancel.com but recently switched to twiiit.com which instead redirects you to any available non-ratelimited instance.
- Make a new site configuration. The idea is to make it accept all connections to twitter/X and send a HTTP redirect to Nitter. You can either do permanent redirection or temporary, the former will just make the redirection cached by your browser. Here's my config in traefik. If you're using a different web server it's not hard to make your own. I guess ChatGPT is also a thing today.
- After making sure your web server loads the configuration properly, it's time to set your DNS rewrites. Set the twitter dot com and x dot com to point to your web server IP.
- It's time to test it! On properly configured device try navigating to any Tweet link. If you've done everything properly it should redirect you to the proper tweet on your chosen nitter instance.
I'm looking forward to hearing what you all think about it, whether you'd improve something or any other feedback that you have:) Personally this has worked flawlessly for me so far and was able to properly access all post links without needing an account anymore.