Automatic source prefix detection