I am not suggesting that Rahab's house (per Joshua 2.1) was a caravanserai. What is fascinating is that a caravanserai (or something similar to it) would probably have been the place the spies would have been expected to lodge. The Jericho authorities would also likely have looked for them in such a place. But they were obviously watching Rahab's house as well, which we know from her tale to the authorities of the spies' escape.
This is a video which gives a picture of a modern-day caravanserai. This one was built in the 13th century, AD, which means it is centuries older than the situation we encounter in Joshua 2. But like many of the wonderful things on youtube, this one can give us a picture that helps our understanding.