This bug has started occurring in the past week after we upgrade Django on our servers: it does stricter Host validation on HTTP requests (evidently disallowing underscores) which is why these URLs are 500ing.
Well, I've figured it out. First of all, you need to rename both your account AND you repo. So, if you have my_account and my_account.bitbucket.org your new names will be myaccount and myaccount.bitbucket.org
This will return web access to you repository
Please make it work again under "old" URL (domain name), because the software is already deployed on thousands of computers and checking exactly that URL for updates. I don't have a time-machine to change the URL in already deployed software, so the old URL must be restored. It's super dumper important for me. If underscore is not allowed in domain names, it shouldn't have been allowed from the beginning. But it was and it was working just fine until recently. Please just restore the old behavior ;-)