XMPP Error: 404: Remote Server Not Found

I recently moved myself away from yet another Google service (nothing against you Google I just like having control over my stuff) and am now running my own XMPP server. I have a rather interesting situation though. Since I use Google Apps, I already had Google Talk set up for my domain. This wasn't too bad a problem since you can just disable that. The real problem arose when I tried to create my XMPP server on a server not directly referenced by my DNS A records. We'll say the server is located at chat.bitnode.net for this example.

The issue arose that when I configured the server so the users' addresses were user@bitnode.net instead of user@chat.bitnode.net. When I had the users names @bitnode.net, I received the error 404: Remote Server Not Found on all of my friend requests. At first, I thought that was because my jabber server couldn't talk to the Google server where my friend's accounts were located. Then I realized (unfortunately hours later), that it was an error being returned by Google's servers because they couldn't find MY server at the location the usernames indicated (IE: bitnode.net). My guess is this has something to do with server dialback.

So, a quick rundown of where we are to make sure we're all on the same page... An example of a username is jimminy@bitnode.net. The jabber server is located at chat.bitnode.net. The username indicates that the chat server is located at bitnode.net, which is not the case.

Now the problem is pretty obvious. The 404: Remote Server Not Found error is because Google's jabber servers are looking at bitnode.net when the server is located at chat.bitnode.net.

Thankfully, the solution is relatively simple to implement, but it does require access to DNS for your domain. The solution here is to put a few DNS SRV records in. Due to the fact that everyone's setup is different, I will use the default ports for my SRV strings. _xmpp-client._tcp	yourdomain.net	5	0	5222	fqdn.to.server.net _xmpp-server._tcp	yourdomain.net	5	0	5269	fqdn.to.server.net

So what we are saying here (at least my understanding of it is) that if an xmpp connection (_xmpp-server._tcp) tries to connect to yourdomain.net on port 5269, the traffic is seamlessly sent to fqdn.to.server.net. Some additional info, the 5s are priority and the 0s are weight.

With that, wait fifteen or so minutes for the changes to the master zone to take effect and give it a try. This should fix the issue with all of the jabber servers out there, but I have only tried this on ejabberd and OpenFire so far.

I hope this helped someone out. Please let me know in the comments if anyone has any questions.