You could set up an onion service with HiddenServiceAuthorizeClient
, that would allow you, and only you, to access localhost resources through Tor Browser without any modifications or special settings. This is the least likely to fail catastrophically.
If and only if you are going to use it to view purely localhost content (e.g. you don't reference external resources on the site) then you might try this:
Set aside a distinct and clearly marked copy of Tor Browser then follow this guide to use Tor Browser with an upstream transproxy, this will make Tor Browser disable its own proxying and just connect directly. You can skip the bits about the control port and ignore the Tor Button errors since you're not using Tor at all.
I cannot stress enough just how important it is that you do not allow those environment variables to affect (infect?) any copy of Tor Browser you intend to use for actual browsing. Possibly you want to do this from a computer that is totally disconnected from the network, to be certain.